JsonToArray and ArrayToJson on LiveCode Server

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
matthew@majic.co.uk
Posts: 3
Joined: Wed Mar 29, 2017 9:19 am

JsonToArray and ArrayToJson on LiveCode Server

Post by matthew@majic.co.uk » Tue May 14, 2019 11:27 am

So 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 tips or guidance would be most appreciated.

Matt

AndyP
Posts: 420
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: JsonToArray and ArrayToJson on LiveCode Server

Post by AndyP » Wed May 15, 2019 7:40 am

Andy Piddock

http://2108.co.uk/tinyide/ - Mini LC IDE alternative

http://2108.co.uk/script-editor-themer/ - Script Editor colour theming

http://livecodeshare.runrev.com/stack/897/LiveCode-Multi-Search - Search across 8 LC resources

matthew@majic.co.uk
Posts: 3
Joined: Wed Mar 29, 2017 9:19 am

Re: JsonToArray and ArrayToJson on LiveCode Server

Post by matthew@majic.co.uk » Wed May 15, 2019 5:00 pm

Thanks for the response, however I was looking to use MergJSON as this is the library used in the standalone and it would be nice to be able to reuse code on the server without needing to worry about the differences between MergJSON and fastjson (or easyjson).

I got to the point of finding the externals in "...\LiveCode\Ext\mergJSON-1.0.56", however there isn't a .lcm in there so I can't easily load it in server. I've tried loading and using the .dll but haven't had much luck yet.

I've had a look on the forums for loading externals but couldn't find anything that would work in this case.

SparkOut
Posts: 1951
Joined: Sun Sep 23, 2007 4:58 pm

Re: JsonToArray and ArrayToJson on LiveCode Server

Post by SparkOut » Wed May 15, 2019 7:57 pm

I am going out on a limb here, but I don't think you will have success in this endeavour. The merg... externals are mostly written for iOS deployment and the specific architecture differences won't translate. If you want a single codebase, it would be better to adapt the standalone to use fastJson instead of mergJson, rather than trying to make the server work that way.
There are always going to be some differences for LC Server that need to be considered. It's a bit like the difference between a car and a lorry. They both have a steering wheel and drive on the road, propelled by an internal combustion engine, but one is fuelled by petrol/and the other by diesel.
I could be wrong, but I think for sanity, turn the approach around.

Post Reply

Return to “CGIs and the Server”