Google keep Json files - adding yaml meta data

What I’m trying to do

I downloaded all of my google keep notes using google takeout. I manually opened all the JSON files in notepad, and copy-pasted them into obsidian one by one.

I know there are python scripts for this, but I’m not that tech savvy.

Now I have about 1300 notes in a file titled “Google Keep”. The names of each files are “untitled-#”. The number happens to correspond to the position of the note, so as far as I’m aware they are all in chronological order.

Here’s what the raw text of a typical note looks like:

{“color”:“DEFAULT”,“isTrashed”:false,“isPinned”:false,“isArchived”:false,“textContent”:"This text would be the note that I took. “,“title”:this is the title of the note”,“userEditedTimestampUsec”:1588817493657000,“createdTimestampUsec”:1588817421250000,“labels”:[{“name”:“1. Just Notes”}]}

Now if there isn’t a way to clean all that up, I’m fine with that. If I absolutely have to, I can simply delete the JSON meta data as needed. What I’m mainly concerned about is two things:

  1. is there a way to bulk add meta data to notes based on something like a recurring keyword? For example, can I search this folder for the word “stress”, and add a tag called “stress” to each one of those notes? I’d prefer the YAML format so I can use dataview.
  2. This is more of a side question. What advice can you give for analyzing all that information? Is there a way to sort of data mine my journal so that I can spot recurring themes, thought pattern etc.

Things I have tried

For question 1, I tried searching for ways to bulk edit tags. From what I could tell a few folks are working on a plugin but there isn’t a way to do it natively.

For 2, I tried using openai plugins, but the KPI key wouldn’t work. I also looked into data mining, but it’s quite intimidating. I’m hoping that the tagging and subsequent linking of notes would help me out here.

Any help would be appreciated. Thanks.

It should be possible to use either plugin allowing javascript, like Templater, to interpret those JSON structures, and then to change that into whatever format you want in your end notes.

thanks for the reply! I believe I’ve used that plugin along with community provided code, but haven’t made any myself. Any idea on how I can get started with this?

I stored all of the JSON code in the file ForumStuff/f60/f60571/myJson.md, so you’ll need to adapt that to whatever file you’re having it stored in within your vault, and then used this template:

<%*
const dv = app.plugins.plugins.dataview.api

/* Convert the JSON stuff */
const jsonString = await dv.io.load("ForumStuff/f60/f60571/myJson.md")
if ( !jsonString ) {
  window.alert("No json stuff to convert. Bailing out")
  return 
}
const theNote = JSON.parse(jsonString)
_%>
---
labels: <% JSON.stringify(theNote.labels) %>
date: <% tp.date.now("YYYY-MM-DD[T]hh:MM:ss", 0, theNote.createdTimestampUsec/1000, "x") %>
---
##  <% theNote.title %>

Labels[0].name: `= this.labels[0].name`

<% theNote.textContent %>

File.day: `= this.file.day`

To produce this file:

---
labels: [{"name":"1. Just Notes"}]
date: 2020-05-07T04:05:21
---
##  this is the title of the note

Labels[0].name: `= this.labels[0].name`

This text would be the note that I took. 

File.day: `= this.file.day`

Which shows up as:
image

The point being simply that using JSON.parse() on content picked up using await dv.io.load() can be used in the template according to your own wishes and needs. In the template there is also an example of how to convert the date values given in microseconds since Epoch to a date usable by Templater.

I did some mumble-jumble with the labels part, and the note above is legal YAML, albeit it could probably be better formatted with a little TLC… Still, this is more a proof of concept, rather than anything ready for use.

In a better version you’d probably make some loop to traverse your files, and then trigger the creation of the files with a similar template, possibly a templater user function accepting the json file as an input parameter, and creating new files related to theNote.labels[0].name or similar.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.