Turn json string to data set

80 Views Asked by At

I'm able to get a json object back from Python, but it's a string. What's the best way to turn it into a data set in ECL. I feel I would have to save it to a file, then read it as json, but I'm looking for a quicker way.

I'm just getting a string back,

2

There are 2 best solutions below

0
Richard Taylor On

The PARSE() function would be the best/easiest way to do this, but it does not support parsing JSON strings. I have created a JIRA ticket (https://track.hpccsystems.com/browse/HPCC-30018) to add that support, but that feature request may take awhile.

Your simplest option is the one you already mentioned -- write the string to a file, then declare that file as a JSON file and read it in a separate workunit. Otherwise, you can just "manually" parse it.

0
Bob Foreman On

In addition to what Richard said, please have a look at the FROMJSON and TOJSON ECL functions as well. The FROMJSON function takes any JSON string and parses it into a target RECORD.

Bob