File format for import

I am looking for a way to import files I can generate myself (data coming from another system), like json files, where I can pass along as much information as possible, like

  • creation date/time
  • tags
  • geo location
    and these notes also contain media files, like references to images and videos.

I would like to create these files myself and then throw all of them into DT at once.

Any idea how this could be done, which file format would work for this purpose and is this documented somewhere?

This question is so general, that I feel tempted to reply with ā€œyes, is possibleā€. More so since DT imports whatever you want it to import. Also JSON. Another quotation entirely is if you can put those data to use in DT, ie If itā€™s searchable.

If youā€™re thinking about semi-structured data like JSON, why not use a No-SQL database with it?

The reason why I ask is, because I donā€™t see any telling options in the import menu and which kind of data structures are expected as for note-creation-timestamp, geolocation and so on.

Am I missing some part of the documentation somewhere?

Markdown allows for metadata in the frontmatter (cf documentation for MultiMarkdown)

Why are you wanting to import JSON files? Thatā€™s not a format for general use.

Maybe I didnā€™t explain well enough. I want to create RTF notes automatically, but want to bring along additional properties and media I mentioned above.
The content of the note is not JSON, it will contain just plain text, prefrerrably formatted with headlines and text blocks.

Like this example:
{
ā€œtitleā€: ā€œmy titleā€,
ā€œcontentā€: ā€œhere comes content, maybe with formats?ā€,
ā€œgeo-locationā€: " 52Ā° 30ā€˜ 58.32 N 13Ā° 22ā€˜ 39.72 E",
ā€œtagsā€: [ ā€œtag1ā€, ā€œtag2ā€]
ā€œdate createdā€: ā€œ2021-03-14Z12:34:14ā€,
ā€œdate updatedā€: ā€œ2023-07-16Z18:14:34ā€
}

Using JSON as a vector for creating rich text files is a non-standard vector and thereā€™s no direct support for it. (Itā€™s actually the first time I can recall anyone even mentioning it.)

It would be possible via scripting but again, thereā€™s nothing built-in for this.

However, it also feels like killing a fly with a shotgun. Iā€™d suggest you read the Help > Tutorials > Using Templates tutorial, as creating and using templates is a fairly simple affair.

To use that as you described in DT, youā€™ll have to write a script. It must extract the metadata, create an RTF record, set its content and the metadata. Feasible, but may be not practical.

Iā€™d would have to create several 1000 notes this way, so I was thinking along the lines like handling it like an enex-import would handle this, where it finishes importing within a very short amount of time.
Doing this via scripting sounds more like a very slow and cumbersome way of doing this.

Why? Please clarify what youā€™re actually doing and what ā€other systemā€ youā€™re referring to in your inital post.

1 Like

I already said that MultiMarkdown allows to include metadata. Why not use that then?

I am looking for a way to archive data from an old forum in a way I can still access its content properly.
I have a huge json file containing an entry per post and each entry has the above mentioned meta data and also contains photos.

I can develop a parser to cut the big json structure into small pieces and ofc also transform the format.

What would be the resulting file format in DEVONthink?

I would like to create one RTF note per thread. The note can contain media files attached though.

Python has extensive capabilities of parsing JSON format data. Perhaps you, or someone you hire, could make some code to do this. From first glance it does not seem too difficult since you know exactly what you want. Just an idea.

1 Like

I am not struggling parsing the data I have, I donā€™t know which data format is required to import that data in bulk.

You can import pretty much any data into DEVONthink. But DEVONthink does not have unlimited capabilities to present (Preview) the fileā€™s content. Also (probably) does not have unlimited capabilities to index files that the app does not know how to Preview. DEVONthink has built-in capabilities, and the app relies on macOS services. The DEVONthink documentation, and other experts can comment, of course, on this.

If you can parse the data, great first step. Your approach to create RTF files seems ok as you say you have attachments and RTF can handle attachments and previewable in DEVONthink. So, do some trials and see what happens. Parse a few records, some with attachments, into RFT and then import.

1 Like

After looking into the topic in more detail and the discussion here, I think the easiest way is to convert the data to enex and import that. That would probably be the easiest way to get the bulk import going without much hassle.

ENEX is just XML, right?

JSON is a more modern file format, so I donā€™t really understand what this should give to you.

For using DT / DTTG you need other formats anyway, like Text, Markdown, RTF or PDF.
This means, you need to extract this content anyway!

Converting from JSON to ENEX is unnecessary, I believe.

I just did something similar with JSON exports from the Drafts App, to get Markdow files from this - I needed ā€œmillerā€ (mlr) and ā€œjqā€ to accomplish the conversion from JSON to Markdown in a bash script, but it worked great!

And the same could easily be accomplished with JavaScript and osascript on the command line.