LC Web integration is not good enough

Andre Garzia andre at andregarzia.com
Tue May 1 19:20:59 EDT 2018


Monte,

The problem is that no web api expects an object with numeric keys, it
expects an honest, real, array. The fact that LC arrays are actually
hashmaps is awesome, I love them as well, but it still makes it impossible
to export arrays from LC which are really common on Web APIs. JSONExport
library should check if the keys of a given array level are all numeric and
cast it to a list type.

Thats is what I say when RunRev web integration is not good enough. They
provide a json import and export function but it doesn't work well enough
for you to call any API that expects an array... We always go like 70% or
80% of the way in a feature and then there is a new LC Infinite Ultra
Campaign to get some new stuff in when the current stuff is not yet ready.

Same thing with executing JS inside a WebView Widget, we need to use the
"do in widget" statement but this doesn't have a way to bind values, so you
end up assembling a JS string by hand in hopes that you got all the correct
quotes right because you need to inline all params as literal objects...

:-(

On Mon, Apr 30, 2018 at 10:42 PM, Monte Goulding via use-livecode <
use-livecode at lists.runrev.com> wrote:

>
>
> > 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:
> >> Andre,
> >> 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.
> >
> > https://quality.livecode.com/show_bug.cgi?id=19698
>
> 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.
>
> Cheers
>
> Monte
> _______________________________________________
> 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
>



-- 
http://www.andregarzia.com -- All We Do Is Code.
http://fon.nu -- minimalist url shortening service.



More information about the use-livecode mailing list