jsonImport or JSONToArray

Andre Alves Garzia andre at andregarzia.com
Tue Oct 23 19:04:18 EDT 2018


As you folks may have seen earlier today, I've shipped a new product 
here on the list. While I was building the demo stack for this plugin, I 
had the same problem as you describe. In my case it boiled down to the 
automatic inclusions not working, I ended up needing to do manual 
inclusions and then it worked.

On 10/21/2018 11:59 PM, Matthias Rebbe via use-livecode wrote:
> Douglas,
>
> did you try to select the inclusions manually in StandaloneBuilder settings?
>
> I might be wrong, but i think i remember there was a problem with including that library when “searching for inclusions” was selected in the SB settings.
>
> Regards,
> Matthias
>
>
> Matthias Rebbe
>
> free tools for Livecoders:
> https://instamaker.dermattes.de <https://instamaker.dermattes.de/>
> https://winsignhelper.dermattes.de <https://winsignhelper.dermattes.de/>
>> Am 22.10.2018 um 00:45 schrieb Douglas Ruisaard via use-livecode <use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>:
>>
>> Has anyone recently tried to create a standalone app which includes either a jsonImport or JSONToArray call?
>>
>> While my code works perfectly when run within the LC API, once a standalone is produced, it chokes  on either one of these calls.  I've reduced the code to its bare essentials.  A sample/simple JSON string I am trying is:
>>
>> {
>> "array": [
>>    1,
>>    2,
>>    3
>> ],
>> "boolean": true,
>> "null": null,
>> "number": 123,
>> "object": {
>>    "a": "b",
>>    "c": "d",
>>    "e": "f"
>> },
>> "string": "Hello World"
>> }
>>
>> This string is embedded as a Custom Property within a button.  The button calls the following:
>>
>> on mouseUp
>>
>> // just empty everything to make sure things are in a known state
>>
>>      put empty into temp
>>      put empty into tArray
>>      put empty into dispArray
>>      put empty into tJson
>>
>>      get the json of button "ThingSpeak_Fetch"
>>      put it into testJson
>>
>> // display the JSON before it is converted into an array
>>
>>      answer "Simple JSON example:" & cr & testJson
>>
>> // this line (either "version") will choke the standalone... it doesn't lock it up in the API
>>
>>      put JsonToArray(testJson) into tArray
>>      //put jsonImport(testJson) into tArray
>>
>>      put displayArrayData(tArray,  "") into dispArray
>>      answer dispArray
>>
>> end mouseUp
>>
>> function displayArrayData pArray, pIndent
>>      # create the variable that loops through the keys in the array
>>      local tKey
>>      if pArray is an array then
>>           # print information to indicate that we are entering a new nested level of the array
>>           get "Array" & return
>>           # print full stops that allow the reader to track the depth of an element
>>           put "." after pIndent
>>           # create the indentation
>>           put tab after pIndent
>>           repeat for each key tKey in pArray
>>                # call displayArrayData with a nested array
>>                put format("%s[%s] => %s\n", pIndent, tKey, displayArrayData (pArray[tKey], pIndent)) after it
>>           end repeat
>>           delete the last char of it
>>           return it
>>      else
>>           return pArray
>>      end if
>> end displayArrayData
>>
>> The function call simply outputs the converted array.... and will do so when this code is run from within the API ... but create a Windows standalone and the array output is never generated.
>>
>> I've tried this in Windows 7 Enterprise SP1, LC: 8.1.9, 8.1.10 and 9.0.1 ... also tried on MAC Sierra (10.12.6) and LC 8.1.9
>>
>> All platforms behave identically as described above
>>
>> Any help would be appreciated... meanwhile I'll be submitting this to LC directly
>>
>> Douglas Ruisaard
>> Trilogy Software
>> (250) 573-3935
>>
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com <mailto: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