how to index a collection
Posted
#1
(In Topic #200)
Enthusiast

listofdata = JSON.Decode(File.Load("~/airplane files/Conscendo S2.srm"))
myindex = "data" & "," & "autopilot" & "," & "altHoldRate"
Print listofdata.count ' this returns a number 9
Print listofdata.Length ' also returns a number 9
Print listofdata[myindex]
print count and length work and return a number, but the indexing does not work.
what am I doing wrong?
Posted
Guru

I cannot work out what you mean by needing to 'index' the data. I presume listofdata is a Collection.
I have attached a sample program that opens and displays a JSON file which may help. If not please can you post a copy of your JSON file and a little more detail of what you are aiming for.
Posted
Enthusiast

need to use "[ ]" instead of " , " …. square brackets instead of a comma
1 guest and 0 members have just viewed this.



