Skip to content
\n

If I understand correctly, it is not possible to import this kind of JSON data into a Danfo data frame directly because of the nesting. For now, I've resorted to writing my own “flattening” function that converts the data into something like this:

\n
[\n  {\n    \"id\": 1,\n    \"foo_bar_baz\": 23\n  },\n  {\n    \"id\": 2,\n    \"foo_bar_baz\": 99\n  }\n]
\n

This data can now be consumed by danfo.read_json.

\n

I'm wondering, though – is this the correct approach? Is there an easier way, which I'm missing?

\n

Thanks in advance for your help!

","upvoteCount":2,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

@pahund Yes, Danfo does not support nested JSON files.

","upvoteCount":1,"url":"https://github.com/javascriptdata/danfojs/discussions/280#discussioncomment-1324715"}}}
Discussion options

You must be logged in to vote

@pahund Yes, Danfo does not support nested JSON files.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@pahund
Comment options

@risenW
Comment options

@pahund
Comment options

Answer selected by pahund
Comment options

You must be logged in to vote
1 reply
@idhamari
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants