Reputation: 2980
The functions JsonToArray and ArrayToJson work fine on LC normally, however I recently tried to use these functions on LC Server and they don't work, just get the error
Function: error in function handler (JSONToArray)
So, I've resorted to using fastjson for now, however I'd love to use the same code for server that I use in LC apps (there are nuanced differences between fastjson and the native functions).
I've done a fair bit of searching but haven't found a definitive answer on how to get these functions working on server.
Following is the set up I'm testing on
Windows 10 Enterprise (test environment)
Apache 2.4
LiveCodeCommunityServer-9_0_2
Any guidance would be most appreciated.
Upvotes: 1
Views: 416
Reputation: 603
External libraries like this are not automatically included in the LiveCode Server build. You have to move the library to your server manually, then load the extension you want to use. I have not done this exact thing but I did need to use the JSonExport and JSonImport functions in a LC server script. This is what I had to do:
Tools\Extensions
. My functions were in the library com.livecode.library.json.Load the extension in your .lc file, like this:
load extension from file "com.livecode.library.json/module.lcm"
After that you should be able to call the function(s). I assume the procedure would be similar for your JSONToArray call. I did notice that the library for your function is mergJSON, which can be found in Tools\Ext\mergJSON-1.0.56
. There is no .lcm (a LiveCode Builder binary) file in that folder, so it may be you'll have to load the .dll file. Experimentation is in order.
Upvotes: 1