Importing data from theBrain into DT

Hi all
New to this place, I have looked around and haven’t found the answer to the following -of course, please excuse me if I didn’t look in the right places-
Having used TheBrain (currently version 11) for close to 4 years, I have generated quite a few thousand “thoughts”, links and attachments. I would now like to migrate all of this data to DT (version 3.5.1). Apparently the “best” format for exporting from TB is JSON as it preserves most of the info, links and so on.
Hence my question : how can I get this JSON data into DevonThink?
PS : I am by no means an AppleScript expert…
Thanks in advance for any help and suggestions.

Welcome @ClaudeB

There is no direct import from The Brain to DEVONthink.
And JSON data would likely not be very useful as a general format.

If you can export a few thoughts, what is contained in the JSON data?

Hi GrenouilleBleue (that’s BlueFrog in french)
TheBrain 11 offers 3 alternatives for export : JSON, a folders structure, and a text outline file.
They recommend JSON as the best choice, I take it as the richest format, offering the highest chance of transferring all the info.
Should I make a sample database and export it in each of the 3 available formats for you to take a look?

GrenouilleBleue (that’s BlueFrog in french)

Very cool! :slight_smile:
(It’s funny as I sometimes mistype my handle as BLEUFROG and think, “That looks french.” - haha)

You can do the exports, for sure. Hold the Option key and choose Help > Report bug to start a support ticket and attach files for me to inspect. Thanks!

Hi BlauerFrosch

Done! It’s ticket #274156

Haha! Got your ticket. Thanks.

Any comments regarding the JSON method (or any other?) for transferring data between TheBrain to DTP? Seems like Export > Folders may be the best alternative. Then Import Files and Folders in DT. There is no link, but it seems to keep the hierarchy. Then it is a manual job of linking between the 2 sides.

If the program exports JSON, you could write a JavaScript script to import it (the JSON data) into DT. DT can execute such scripts (although not in smart rules).

To be honest I haven’t had (taken?) the time to write a Javascript import procedure. I’m not too experienced in Script so it would take me too long. I am therefore currently still keeping TheBrain on my computer, just to access my data.
Regarding the Folders export route, yes it seems to keep the hierarchy, but in my case I need the links too. And for 3000+ “thoughts” and even more links, I just don’t feel like doing this by hand.
So either some magic happens, or I find the time to write a proper routine, or it will stay as is for the moment.
As a side thought, it probably means it doesn’t “hurt” enough to have such an inefficient setup…

Where would you store these links in the DEVONthink records? Appended to the actual text? Or as custom metadata? If so, which metadata type?

Writing an AppleScript should be doable but I‘ve no idea where to store the links.

I use links in TheBrain in 2 ways : between thoughts, and in-text links (I mean a link from within the text of a thought to another thought).
Migrating to DT, I would seek to replicate this, probably by using a wikilink in the text of a DTnote. Maybe with a "see [[linkednote]] " line at the top -or at the bottom- of a DTnote.
But once again, I haven’t thought this through, as I haven’t got the time right now to code.

Yes, I got that. The reason I asked is that I have time to code and if you don’t insist on doing it yourself I would try to write it.

1 Like

@shiiko unfortunately this would skip a lot of folders as TheBrain creates aliases and DEVONthink doesn’t import aliases. (Edit: But it’s possible with this script).

I’m writing a script that works around this situation, but I just downloaded TheBrain last week, so I have no idea about the features and how they can be used, also I’ve of course no good test data. I’ve included as much data (that I’m aware of …) in the import as possible, but I’m quite sure I missed things that would be obvious for experienced TheBrain users. I don’t even know how brains are structured, if more than one top thought is possible etc.

My intention is to only use features that can be somehow exported, but without knowing the app it’s quite hard to figure if I’m on a good way.

Would you or other TheBrain users try the script on a copy of real data?

@pete31 I would be willing to try a test. But TheBrain website has some demo Brains that can be downloaded that come pre-filled. Also note that TheBrain is going through a major update and I am using their new v12 which introduces backlinks, among other things.

Great! Didn’t know of demo Brains, I’ll take a look.

Where are backlinks visible? In the plex or in the thoughts? I guess they didn’t change the whole linking system so it’s probably easy to include backlinks. Ah, moment! The script already includes backlinks :sweat_smile:

I downloaded an update a few days ago but my TheBrain is still Are you beta tester?

In some hours I’ll post a first version.

I think your best bet would be to use the Export Brain Data feature to export a “brain” to JSON and then parse that export file. TheBrain does not support AppleScript, JXA, etc.

The “Folders” and “Text Outline” export options are of limited usefulness.

I made a quick-start brain for you and exported it to JSON. Here’s the data:

Link will self-destruct 20201101

1 Like

Hi korm, the trick is to use both, “JSON” and “Folders” export. This way we’ll get both, the links and the folder structure :slight_smile:

However I didn’t find a way to convert in-text links, so clicking them in DEVONthink will open the thought in TheBrain.

I think it could be possible to replace them afterwards by querying the SQL database, but I didn’t try it yet (and that’s something I’ve never done so I’ll do the basics first).


Thanks! Could you also upload a “Folders” export of this Brain? Without it I can only test a part of the script.

Looks like there’s a bug in the current v12 beta – it crashes when it tries to export as folders.

If you ever have questions re querying the sqlite db, let me know.

1 Like