FROMJSON to DataSet
How can I turn the json array into a child dataset verses a SET?
- Code: Select all
x := '{"childNames": ["Sasha Obama","Malia Obama"]}';
PersonRec := RECORD
DATASET({UNICODE name}) childNames {xpath('childNames')};
END;
line := FROMJSON(PersonRec,x);
line;
- wjblack
- Posts: 27
- Joined: Mon Jul 11, 2016 12:45 pm
Hi wjblack,
Divide and conquer:
Yours
Allan
Divide and conquer:
- Code: Select all
x := '{"childNames": [{"FN" : "Sasha"},{"FN":"Malia"}]}';
PERSONRec := RECORD
STRING FN{xpath('FN')};
END;
PeopleRec := RECORD
DATASET(PERSONRec) childNames {xpath('childNames')};
END;
FROMJSON(PeopleRec,x);
Yours
Allan
- Allan
- Posts: 444
- Joined: Sat Oct 01, 2011 7:26 pm
In addition, I always find it worth my while to search the Forum on say 'JSON'.
There are other posts that might have helped.
Yours
Allan
There are other posts that might have helped.
Yours
Allan
- Allan
- Posts: 444
- Joined: Sat Oct 01, 2011 7:26 pm
Thanks for your help. I always do start with a search of the forum.
- wjblack
- Posts: 27
- Joined: Mon Jul 11, 2016 12:45 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest