Hi, I have a few hundred notes in Agenda and want to export them into a custom data format. The actual target data format is not relevant here, but I’d like to include as much data and metadata as possible.
One of the important pieces of metadata to me is the various dates stored with a note.
Agenda’s export file format is quite easy to understand (thanks for this, much appreciated!). If you export your notes as an Agenda File, you get an .agenda
file that is really a ZIP archive. After unzipping, there’s a Data.json
inside that contains all the note data, plus a directory for attached files.
I started writing Swift code that can read the Data.json
file into my custom data structures (using Decodable
). So far, so good, it’s working pretty nicely already, but I have trouble understanding some of the data in the JSON file:
timeZoneIdentifier
timeZoneIdentifier
is sometimes encoded as a plain string (e.g. “Europe/Amsterdam”), but sometimes it looks like this in the JSON:
"timeZoneIdentifier" : [
"JSON_ENCODED_TYPE_Data",
"8\/P0UQjwcXR29fD3cXENUtBVMDc0NHQyNTXQNXE1cNE1cXG21LU0NjPRtbB0dTQ0dXJyMXWxAAA="
]
I believe the string is base-64-encoded binary data, but I don’t understand the binary data format that’s encoded here. I tried decoding it as a (binary) plist or an NSTimeZone
value using NSKeyedUnarchiver
, but no success.
Date values
Similarly, date values are sometimes encoded like this (which I can decode easily):
"endDate" : [
"JSON_ENCODED_TYPE_Date",
"1589148000.0"
]
But sometimes date values are also encoded as opaque binary data that I don’t know the format of:
"startDate" : [
"JSON_ENCODED_TYPE_Data",
"8\/P0UQjwcXR29fD3cXENUtBVMDc0NHQyNTXQNXE1cNE1cXG21LU0NjPRtbB0dTQ0dXJyMXWxAAA="
]
Others
There are a few other keys that use similar JSON_ENCODED_TYPE_Data
encodings, but I haven’t looked at those yet.
Any pointers on what these binary blobs contain and how they can be decoded would be much appreciated. I understand if you don’t want to divulge any secrets of your implementation, but I’d love it if the export data format was truly open to allow us to process our data in whatever form we want. Thank you!
PS: If there’s interest I’m open to sharing my code once I got it working. I can’t promise it supports every Agenda feature (only the ones I use in my notes) and I’m not planning on maintaining it, but it can be a starting point for your own experiments.