From the Language reference for Xojo.Data.ParseJSON:
I am unsure of what this means in practical terms when the JSON text I am working contains arrays of dictionary-like items. From my tests the Xojo.Data.ParseJSON command seems to work just I hope it would, retaining order of the items. Does anyone know under what circumstances might it throw off the order in which the JSON stores it?
Here’s a shortened example of the JSON (in real life this often will have hundreds of items in each array, but it will give you an idea):
{"libraries":[
{"libraryName":"My Categories","libraryID":0,"categories":
[{"categoryName":"Stuff I've learned","categoryID":1,"items":"222,235,336"},{"categoryName":"July 15","categoryID":2,"items":"1000,1001,1222"},{"categoryName":"Learn later","categoryID":3,"items":"1,2,3,4,5,6"}]},
{"libraryName":"Egyptian Arabic","libraryID":1,"categories":
[{"categoryName":"Animals","categoryID":1,"items":"322,335,336"},{"categoryName":"Art and Literature","categoryID":2,"items":"422,435,436"},{"categoryName":"Clothing and Accessories","categoryID":3,"items":"522,535,536"}]},
{"libraryName":"Modern Standard Arabic","libraryID":2,"categories":
[{"categoryName":"Animals","categoryID":1,"items":"322,335,336"},{"categoryName":"Art and Literature","categoryID":2,"items":"322,335,336"},{"categoryName":"Clothing and Accessories","categoryID":3,"items":"322,335,336"}]}
]}
When I parse this, Xojo gives me just what I would hope for, in terms of the order of the items:
[code]Libraries
- My Categories
- Stuff I’ve learned
- July 15
- Learn later - Egyptian Arabic
- Animals
- Art and literature
- Clothing and accessories - Modern Standard Arabic
- Animals
- Art and literature
- Clothing and accessories[/code]
Thanks for any insights you can give into this.