Hi!
I am trying to handle json data on onion-based rest server.
In a situation where client posts a regular json object e.g {"xxx":"yyy"} the following code works well:
...
onion_dict jreq = onion_dict_from_json(onion_block_data(dreq));
char pchTemp=onion_dict_get(jreq,"xxx");
if(pchTemp) strncpy(strX,pchTemp,64);
However, in a situation where client posts something like:
{"rec":[{"xxx":"yyy"},{"www":"yyy"}]} I can not find the way
to iterate the array got from json. How to handle this using onion functions (or not)?
Hi! I am trying to handle json data on onion-based rest server.
In a situation where client posts a regular json object e.g {"xxx":"yyy"} the following code works well: ... onion_dict jreq = onion_dict_from_json(onion_block_data(dreq));
char pchTemp=onion_dict_get(jreq,"xxx"); if(pchTemp) strncpy(strX,pchTemp,64);
However, in a situation where client posts something like:
{"rec":[{"xxx":"yyy"},{"www":"yyy"}]} I can not find the way
to iterate the array got from json. How to handle this using onion functions (or not)?
Thanks a lot
Alex