The question now is: how do I actually turn that into data? I have tried JSON to table and it just returns over 1000 columns which not a lot in them. Thank you everyone
Hi,
If you want specific fields from a JSON doc, I recommend the JSON Path node. JSON Path is a language for expressions used to extract data from JSON. You can find documentation and examples here. Itβs very handy for turning JSON into tabular data. Sometimes it makes sense to use two JSON Path nodes in succession: one to get the elements that will turn into individual rows (collection query with output type JSON), then an Ungroup node to turn the list into rows, then another JSON Path to unpack the element-JSONs into multiple columns.
Kind regards,
Alexander
Hi again,
Often it is also good to combine JSON Path with Ungroup and JSON to Table. I have created a small example workflow for your URL that extracts the dimensions.
Kind regards,
Alexander British Stats.knwf (10.2 KB)
Thanks, that works! I have no idea what you did and would never have been able to figure that out myself, but I shall investigate and see if I can get my head around it.
Hi,
Happy to explain. The JSON to Table node just takes a document and turns it into a single row. This means nested JSON objects are turned into additional columns. Often, what you really want is to turn a list of objects from the JSON document into individual rows. This can be done by combining the JSON Path with the JSON to Table. The JSON Path extracts the individual list items into a KNIME collection cell, this is then turned into separate rows using Ungroup. Now you have one JSON document per list item. The JSON to Table now can properly unwrap those into columns.
Kind regards,
Alexander
Thank you. I get what it does now; I just need to figure out the path node and how that is laid out so I can do it myself in future! I should be able to figure it out with your example and trying a few myself.