LC Web integration is not good enough
monte at appisle.net
Mon Apr 30 21:42:27 EDT 2018
> On 1 May 2018, at 11:29 am, Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
> On 04/30/2018 03:15 PM, Ralph DiMola via use-livecode wrote:
>> I'm using JSONToArray and ArrayToJSON for round trip with no problems. I'm
>> storing an LC config array in a JSON text file, then later read the file
>> back into an LC array. The only criticism I have is the formatting of the
>> JSON in the text file could be better for manual changes with a text editor.
>> Other than that it faithfully saves/recreates the LC array.
> ... as long as you don't have to deal with JSON lists.
ArrayToJSON deals with JSON list differently to JSONExport. ArrayToJSON uses mergJSON which checks if the array keys are a numeric sequence and assumes it’s a list. There is a way to force it to be an object if required.
JSONExport on the other hand is done in LCB and LCB has a proper list type. The issue is when passing a LCS array to LCB there is no way for the engine to know for sure if your array is a list or map so it keeps it as a map with string keys. In the long run if we ever get proper lists in LCS then JSONExport will likely do as you are expecting.
More information about the Use-livecode