Help with Nested Arrays - Json

Phil Davis revdev at pdslabs.net
Mon Apr 18 20:46:55 EDT 2016


Are tCard, tStack tGroup etc meant to be containers? If so, you don't 
want them in quotes. That will make them each act as a literal value, 
not as a container of a value.

I love low-hanging fruit.  :-)

Phil Davis


On 4/18/16 4:03 PM, Sannyasin Brahmanathaswami wrote:
> Now I want to load this into a nested array and run JsonExport.  I go this far:
>
> local tGroupCounter, aPortalLinks
> on mouseUp
>     # clear the array
>     put empty into aPortalLinks
>     answer "Use Data Input path?" with "No" or "Yes"
>     if it is "no" then
>        answer file "Choose your tab delimited file" with "OK"
>        put it into fld "dataInput"
>     end if
>     put url ("file:" & fld "dataInput") into tData
>     set the itemdel to tab
>     
>     put "SivaSiva" into aPortalLinks["tStack"]
>     put "0" into tGroupCounter
>     
>     repeat for each line x in tData
>        put item 1 of x into aPortalLinks["stack"]["tCard"]
>        put item 2 of x into tGroupType
>        if tGroupType = "link" then
>           add 1 to tGroupCounter
>           put (tGroupType & tGroupCounter) into tGroupType
>        end if
>        put tGroupType into aPortalLinks["tStack"]["tCard"]["tGroup"]
>        put item 3 of x into aPortalLinks["tStack"]["tCard"]["tGroup"]["label"]
>        put item 4 of x into aPortalLinks["tStack"]["tCard"]["tGroup"]["imgPath"]
>        put item 5 of x into aPortalLinks["tStack"]["tCard"]["tGroup"]["message"]
>        put item 6 of x into aPortalLinks["tStack"]["tCard"]["tGroup"]["target"]
>        put item 7 of x into aPortalLinks["tStack"]["tCard"]["tGroup"]["orientation"]
>     end repeat
>     put JsonExport(aPortalLinks)
> end mouseUp

-- 
Phil Davis





More information about the use-livecode mailing list