JSON

Tore Nilsen tore.nilsen at me.com
Tue Aug 15 10:03:13 EDT 2023


An array of object would be turned into a multidimensional  array with value pairs in LiveCode. Depending on the source the main keys may be numeric or assosiative, like in these examples:

contriesArray[1][name]
contriesArray[1][capitol]
contriesArray[1][inhabitants]

Or 

contriesArray[«Norway"][capitol]
contriesArray[«Norway»][inhabitants]

Tore


> 15. aug. 2023 kl. 15:46 skrev Dar Scott via use-livecode <use-livecode at lists.runrev.com>:
> 
> Thanks, Tore!
> 
> I found these in the dictionary. For JsonImport I noted this:
> 
> The return value may be any of the following types, depending on the content of the file:
> 
> Array (for a JSON object)
> List (for a JSON array)
> String (for a JSON string)
> Number (for any JSON number)
> Boolean (for JSON true or false)
> nothing (for JSON null)
> How would an array of objects be translated? What is nothing?
> 
> Dar
> 
> 
>> On Aug 14, 2023, at 10:58 PM, Tore Nilsen via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> JsonImport will make an array of your JSON data, whereas JsonExport will turn your array into JSON data. Not much fiddling there.
>> 
>> Best regards
>> Tore Nilsen
>> 
>>> 15. aug. 2023 kl. 02:07 skrev Dar Scott via use-livecode <use-livecode at lists.runrev.com>:
>>> 
>>> 
>>> I’m about write some scripts that fiddle with JSON. I have some old stacks of mine about someplace. But, I got to thinking there might be something faster about someplace. Ideas?
>>> 
>>> Dar
>>> _______________________________________________
>>> 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
>> 
>> 
>> _______________________________________________
>> 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
>> 
> 
> _______________________________________________
> 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