Help with Nested Arrays - Json

jameshale james at thehales.id.au
Mon Apr 18 23:13:23 EDT 2016


As Phil pointed out, you seem to be mixing containers with values.

Try...


   put "SivaSiva" into tStack --tStack is a key to the first dimension
   put "0" into tGroupCounter 
    
   repeat for each line x in tData 
      put item 1 of x into tCard -- tCard is the key to the second dimension
      put item 2 of x into tGroupType 
      if tGroupType = "link" then 
         add 1 to tGroupCounter 
         put (tGroupType & tGroupCounter) into tGroupType --this is the
third dimension key
      end if 

     -- now we have keys for the three dimensions we can place values for
each bit of data
     -- and these are associated with the 4th dimension keys  "label",
"imgpath", 
     -- "message", "target" and "orientation"

      put item 3 of x into aPortalLinks[tStack][tCard][tGroupType]["label"] 
      put item 4 of x into
aPortalLinks[tStack][tCard][tGroupType]["imgPath"] 
      put item 5 of x into
aPortalLinks[tStack][tCard][tGroupType]["message"] 
      put item 6 of x into aPortalLinks[tStack][tCard][tGroupType]["target"] 
      put item 7 of x into
aPortalLinks[tStack][tCard][tGroupType]["orientation"] 
   end repeat 
   put JsonExport(aPortalLinks) 
end mouseUp 



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Help-with-Nested-Arrays-Json-tp4703628p4703633.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list