How do I parse a JSON string with embedded arrays using cJSON

If I have a JSON string with an embedded array like this…

testJSON string(’{{“Result”:[’ & |
‘{{“resourceskill”:[“Joiner”,“Plumber”,“Electrician”],“starttime”:“2021-06-25 08:05”},’ & |
‘{{“resourceskill”:[“Joiner”,“Plumber”],“starttime”:“2021-06-28 08:05”}’ & |
‘,{{“resourceskill”:,“starttime”:“2021-06-29 08:05”}’ & |

I can parse the ‘result’ array out and put it into a queue, but I can’t quite work out how to get the embedded resourceskill array out.

Difficult to explain but see attached zip for example (1.7 KB)

You should get an item of result array, then get resourceskill object, see attachment.
ParseTest.clw (1.4 КБ)

1 Like

Many thanks Mike that works great :smile:

Just so I fully understand the solution am I correct in saying that…
resultsItem &= resultsArray.GetArrayItem(count)
means that resultsItem only holds one part of the total array.

So that the GetObjectItem(‘resourceskill’) is restricted to just that bit of the total array and so works?

Yes this is correct.