Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.4K Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

What is the best way to understand the structure of a new JSON file?

Posted 1 year ago

I am doing some work with a number of different api's, each of which return relatively large, nested JSON files. At the moment, I step through the file by doing something like

Data[[1]] etc.,

However, this seems very clunky, and I am sure there must be a function which lets me understand the structure much more quickly.

So, I am hoping someone with more experience can explain how they tackle the problem.

Cheers Andy

POSTED BY: Andrew Burnett
4 Replies
Posted 1 year ago

You should be able to read JSON into an Association. Which function(s) are you using to access the API (e.g. URLRead)?

POSTED BY: Eric Rimbey
POSTED BY: Andrew Burnett
Posted 1 year ago

Well, I don't know how big, complicated, or nested your data is, but you could try Dataset to visualize. I downloaded a sample JSON file from https://support.oneskyapp.com/hc/en-us/articles/208047697-JSON-sample-files . Then,

jsonData = Import[pathToJsonFile, "RawJSON"];
Dataset[jsonData]

enter image description here

I don't know if that's the kind of thing you're looking for. Also, once you've imported the data and have an Association, you can use the association-related functions (e.g. Keys).

Isn't there a published schema for your API?

POSTED BY: Eric Rimbey
POSTED BY: Andrew Burnett
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard