Sun May 19, 2019 8:59 pm
Login Register Lost Password? Contact Us


Trouble loading JSON Dataset

Questions around writing code and queries

Fri May 17, 2019 6:56 pm Change Time Zone

Hi there,

This is the first time I'm working with json. I am having troubles trying to load a json dataset file. I uploaded a file into the ECL Watch and now I am trying to load the file into a dataset to clean the data layout and then perform some queries using it.

The json file does not have a root, so it is one register per line. Something like the example below:
Code: Select all
{"id":"QXAEGFB4oI", "name":"Emerald Chinese Restaurant", "attributes":{"RestaurantsReservations":"True", "GoodForMeal":"{'dessert': False, 'latenight': False}}, "hours":{"Monday":"9:0-0:0","Tuesday":"9:0-0:0"}


I read the documentation and I didn't just really did not understand how I could work with the datasets inside other datasets, like the attributes and the hours that is inside this file.
The 'attributes' field is an array of strings, that each array element is an attribute (name, value), and the 'hours' field is an array of strings of business hours (day, hours).

I was thinking about using the XPATH, but there are different attributes names depending of the record.
I'm just asking for a direction of how to proceed with this kind of data.

Thank you,
André.
andre.martins
 
Posts: 1
Joined: Thu Apr 18, 2019 2:17 pm

Fri May 17, 2019 8:29 pm Change Time Zone

André,

Nested child datasets are covered in the Advanced ECL (Part 1) online course, and XML/JSON in Advanced ECL (Part 2). I think you'll find those helpful (http://learn.lexisnexis.com/hpcc).

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1452
Joined: Wed Oct 26, 2011 7:40 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron