farling42 / obsidian-import-json

Plug-in for Obsidian.md which will create Notes from JSON files
MIT License
85 stars 5 forks source link

"The importer will only read the first object from the supplied JSON file. " #46

Closed Geethebluesky closed 1 year ago

Geethebluesky commented 1 year ago

I'm wondering if there's any plans to have it read nested objects at some point in the future?

Or does anyone have a workaround for this? Thanks.

farling42 commented 1 year ago

Not really. The detection of a file with more than one JSON object isn't trivial, since it relies on accurately parsing the file to determine where one JSON object stops and another one starts.

You could simply add a [ at the start and a ]at the end of the file so that the file becomes an array of JSON objects - you might need to manually add a , at the end of each JSON object.

Geethebluesky commented 1 year ago

Thanks, I understand now this is beyond the scope of the plugin. The files I'm using are already formatted as a top-level array of objects, which have other nested arrays at lower property levels, and that repeats further below. Please close as you see fit. I still find your plugin useful for other structures, thanks for making it :)

farling42 commented 1 year ago

Implemented in 0.31.0