On 23.06.22 14:23, Alex Tweedly via use-livecode wrote:
On 23/06/2022 10:31, Ralf Bitter via use-livecode wrote:
Hi Alex,
the JSONtoArray() function is part of the mergJSON external.
The README of this external describes how to use this function
and it's counterpart JSONtoArray as follows:
Thanks Ralf. I did see that code in the dictionary - but it also says
that those functions are provided in
thews.goulding.script-library.mergjson library, so (I think) I shouldn't
need to put them in myself.
In fact, I did try it anyway - but that simply changes the error to
"handler not found: mergJSONDecode"
Hi Alex, have you added the mergJSON External to your server
installation? I have just tested this again, actually it should work.
My LC Server version is 9.6.6.
Another option would be to load the JSON extension and to use
the JsonImport() function.
Didn't know about jsonImport; it's not mentioned in the dictionary, but
I now see it shows up in a few lessons, etc.
However,I think the real problem for me is "... to load the JSON
extension ...". I wasn't aware I had to load those extensions which are
already part of the standard package (maybe I did that years ago and
have had time to forget :-).
I can't find anything about loading extensions other than what to do in
the IDE.
How do you load extensions to LC Server ? On a shared web provider ?
(on-rev)
You guessed it, use "load extension", example (tested on on-rev):
load extension from file
"/home/rabit/public_html/ritest/application/extensions/com.livecode.library.json/module.lcm"
Ralf
Thanks,
Alex
Ralf
On 23.06.22 01:31, Alex Tweedly via use-livecode wrote:
On 22/06/2022 17:02, Richard Gaskin via use-livecode wrote:
[ ... about using JSON ... ]
But if you don't need interoperability, you wouldn't need to write a
parser, since LC includes a good one built into the engine.
What did I miss?
The fact that Livecode's support for JSON is, hmmm, mediocre at best ??
The parser "built-in" seems to work fine in the IDE, but not on the
server :
<?lc
set the errormode to inline
put the version
put "{'name':'asdf'}" into t
replace "'" with quote in t
put JSONtoarray(t) into tA
put the keys of tA
fails with -
file "/home/alextwee/public_html/rampuk/tJSON.lc"
row 7, col 5: Function: error in function handler (JSONtoarray)
row 7, col 5: put: error in expression
(there's no mention of any platform restricitons in the dictionary).
I tried copying in the sample ode for wrapping JSONToArray around
mergJSONDecode,
which then fails with "error in function handler mergJSONDecode.
(I must admit I encountered this a while ago, figured it was probably
a temporary issue
so I replaced JSON by LSON, and forgot all about it.) This discussion
prompted me to re-try it.
I can't believe this problem isn't causing widespread problems, so
it's probably
something specific about me, or my on-rev account. If anyone has
suggestions, I'll
try them; if not, I'll put it as a bug report into QCC see what happens.
Alex.
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode