Hi Linus,
I haven't tried this directly, but using StringTheory it's reasonably easy to parse.
There are two data structures, an "object" and an "array".
Since the array is simpler, let's deal with that first;
(this is all untested, so you may need to work through it. If you find obvious bugs please let me know here)
str StringTheory
code
str.SetValue(incomingJson)
str.Crop(2,str.Length()-1) ! removes [ and ] from the ends
str.split(',','"') ! separates the lines. Assumes " used for quotable strings, could be ' though.
now each value in the array is in the str lines queue. See
http://www.capesoft.com/docs/StringTheory/StringTheoryClasses.htm#SplitJoin for accessing this queue.
when I said an object is more complicated, well, I lied.
It's the exact same code, except that now the name:value pair are in each line of the queue.
You can use another string theory object to work on these, or just parse them out using INSTRING.
To create a JSON packet you do the reverse;
a) Use the lines methods to create a collection of entries.
b) use JOIN to join them all together as a string
c) use APPEND and PREPEND to add the ] and [ boundaries respectivly.
All in all, no big deal. (which is kinda the point with JSON).
Cheers
Bruce