Nested JSON structures

Just starting out? Need help? Post your questions and find answers here.
User avatar
nblackburn
User
User
Posts: 67
Joined: Mon Aug 19, 2013 1:22 am
Location: United Kingdom
Contact:

Nested JSON structures

Post 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?.
Image
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Nested JSON structures

Post 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
User avatar
nblackburn
User
User
Posts: 67
Joined: Mon Aug 19, 2013 1:22 am
Location: United Kingdom
Contact:

Re: Nested JSON structures

Post by nblackburn »

Thanks, i will give this a go and report back on my progress.
Image
Post Reply