generic JSON importer fails

24 views
Skip to first unread message

Josef

unread,
Jan 4, 2022, 5:40:23 AM1/4/22
to leo-editor
import with at_auto afile.json fails: the body remains empty, at least when the top level entity is an object (e.g. a pair of curly braces). For example this fails:

@language json
{
"doctitle": "Risk Register",
"docno": "CIRR-LI-VHS-MA-0006",
"docversion": "2",
"vm": "IT",
"intent": "planning",
"model": "EQM",
"data": [
null
],
"filename": "CIRR-LI-VHS-MA-0006_2_Risk_Register"
}

Edward K. Ream

unread,
Jan 10, 2022, 5:05:36 PM1/10/22
to leo-editor
On Tue, Jan 4, 2022 at 5:40 AM Josef <joe...@gmx.net> wrote:
import with at_auto afile.json fails: the body remains empty, at least when the top level entity is an object (e.g. a pair of curly braces). For example this fails:

The problem you are having could be called a confusing result of featuritis. If all you want to do is represent json in an outline, you can just use @clean x.json.

@auto x.json or (alternatively) @auto-json x.txt creates a json representation of the outline, complete with a representation of gnx's, uA's, etc. To see this in action, create the original file with @auto x.json, write the external file, and take a look at the result.

HTH. Please feel free to ask more questions.

Edward

Josef

unread,
Jan 11, 2022, 10:26:06 AM1/11/22
to leo-editor
I'll have a look. All I wanted to do for now is edit some already existing JSON files.

I think all the @auto should always behave essentially the same way,
and that means for me that I can use it to read in any arbitrary file,
not just one that was created by Leo.

I was using @clean already, but was hoping the @auto would be able to represent the JSON structure in the outline somehow. 
I realize this is hardly possible, because Leo can't know what to write into the headlines, or even to which level of nodes to go.

I guess I will need write a custom importer for this, since I need to edit (some large) JSON files quite often.

tbp1...@gmail.com

unread,
Jan 11, 2022, 10:50:27 AM1/11/22
to leo-editor
Yes, I think you will need to know the schema of the JSON files to be able to import them in a useful way..  For example, Jupyter notebooks are JSON files, but your files are probably very different.  Leo can import XML files, but they are imported into a single Leo node.
Reply all
Reply to author
Forward
0 new messages