Page 1 of 1

Nested JSON structures

Posted: Mon Sep 22, 2014 12:42 pm
by nblackburn
I appear to have found myself in need of help in figuring out how retrieve the contents of a nested json map.

Code: Select all

{
     "total": 2,
     "jake": {"gender": "male", "age": 26},
     "jane": {"gender": "female", "age": 24} 
}
The data above is an example of the kind of structure i could be dealing with.

How would a retrieve the entire structure into a map without knowing their type as i only appear to be able to get the base elements and not anything nested, any ideas?.

Re: Nested JSON structures

Posted: Tue Sep 23, 2014 8:24 am
by Kukulkan
Hi,

I think you simply missed the JSONType() function:

http://www.purebasic.com/documentation/ ... ntype.html

This allows you to determine the type of a value during parsing.

Best,

Kukulkan

Re: Nested JSON structures

Posted: Tue Sep 23, 2014 8:57 am
by nblackburn
Thanks, i will give this a go and report back on my progress.