JSON not working in Standalones?

tkuypers@telenet.be tkuypers at publishingtools4u.com
Sat Jun 18 14:19:18 EDT 2016


Hi,

I have a question about JSON, or maybe a bug...

1 field to enter a zip-code of a city.
The code in this field: 

on closeField
   put "http://www.opzoeken-postcode.be/@@@@.json <http://www.opzoeken-postcode.be/@@@@.json>" into vURL
   replace "@@@@" with the text of me in vURL
   put JSONToArray(url vURL) into tCities
   put 0 into vCounter
   repeat for each element vCity in tCities
      add 1 to vCounter
      put tCities[vCounter][Postcode][postcode_deelgemeente] & tab after vCities
      put tCities[vCounter][Postcode][naam_deelgemeente] & cr after vCities
   end repeat
   if last char of vCities = numToChar(13) then delete last char of vCities
   if last char of vCities = numToChar(10) then delete last char of vCities
   set the itemdel to tab
   if the num of lines of vCities = 1 then
      put item 2 of vCities into fld "City"
   else
      put vCities into fld "Cities"
   show fld "Cities"
   end if
end closeField

This will place a list of cities and zipcodes into another field.

The function taken from the documentation:

function JSONToArray pJSON
   local tArray,tKeys
   repeat for each line tKey in mergJSONDecode(pJSON,"tArray")
      put JSONToArray(tArray[tKey]) into tArray[tKey]
   end repeat
   return tArray
end JSONToArray


When you enter a Belgian zip-code like 3500, it will return a list of cities, when you enter 2400 it will return only one city.
At least in the IDE it does, when creating a standalone, nothing happens.

I’ve tried this in LC 8.0.0, 8.0.1 (rc 1), 8.0.1, 8.0.2 (rc 1), 8.0.1 (rc 2) and 8.1.0 (dp 1).
In all but  8.1.0 (dp 1) I’ve included all extensions, in 8.1.0 (dp 1) the new “Inclusions”-tab in the standalone settings is disabled, so I can’t select anything there.

Am I missing something?


Met vriendelijke groeten,
Warm Regards,



Ton Kuypers
+32 (0) 477 739 530

Steenweg op Leopoldsburg 100 • B-2490 • Balen • Belgium
www.publishingtools4u.com <http://www.publishingtools4u.com/>






Met vriendelijke groeten,

Ton Kuypers






More information about the use-livecode mailing list