how to create a list in easyJSON
Matt Maier
blueback09 at gmail.com
Sat Dec 31 16:11:50 EST 2016
This code:
put "12345" into tArray["one"][1]
put "12345" into tArray["one"][2]
put "12345" into tArray["one"][3]
put "12345" into tArray["two"][1]
put "12345" into tArray["two"][2]
put jsonfromarray(tArray) into tWhatever
gives me this result:
{"one":{"3":12345,"1":12345,"2":12345},"two":{"1":12345,"2":12345}}
which is a multi-level array, rather than this, which is a single-level
array with lists
{"one":["12345","12345","12345"],"two":["12345","12345"]}
I'm not even sure how to distinguish between the two in Livecode. We parse
strings into lists so often that I'm not aware of a pure list data
structure. Livecode can interpret "12345,12345,12345" as a list if I tell
it to go by item, but it's just a string and that's how easyJSON is
treating it, as one string, not a list of strings.
On Sat, Dec 31, 2016 at 10:08 AM, pink <nabble at mad.pink> wrote:
> in a nutshell, easyJSON creates what you want by using numeric keys
>
> so:
> array[one][1] = 12345
> array[one][2] = 12345
> array[one][3] = 12345
> array[two][1] = 12345
> array[two][2] = 12345
>
> would produce the results you are looking for (technically the numbers
> don't
> have to be sequential, it just has to be that all of the keys must be
> numeric)
>
>
>
> --
> View this message in context: http://runtime-revolution.
> 278305.n4.nabble.com/how-to-create-a-list-in-easyJSON-
> tp4711279p4711289.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list