Hi Ralf,
Thanks - but that's actually a different JSON extension :-) That is an
LCB library that defines JsonExport and JsonImport.
However, I looked around some more, and found Tools/Ext/mergJSON-1.0.38
That's an external which defines mergJSONEncode and mergJSONDecode
But the docs for it (api.lcdoc) describe how it might be expected to be
used, and include ArryToJSON and JSONToArray functions (less than 20
line of LCS). So I copy/pasted those lines into my own LC Server script
- and now everything works (at least for simple tests).
So clearly mergJSON is already included in LC Server - and you only need
to include the following lines for yourself
function ArrayToJSON pArray,pForceRootType,pPretty
repeat for each key tKey in pArray
if pArray[tKey] is an array then
put "}"&ArrayToJSON(pArray[tKey]) into pArray[tKey]
end if
end repeat
return(mergJSONEncode("pArray",pForceRootType,pPretty))
end ArrayToJSON
function JSONToArray pJSON
local tArray,tKeys
repeat for each line tKey in mergJSONDecode(pJSON,"tArray")
put JSONToArray(tArray[tKey]) into tArray[tKey]
end repeat
return tArray
end JSONToArray
-- Alex.
On 18/11/2017 12:36, Ralf Bitter via use-livecode wrote:
Hi Alex,
you should find the JSON extension in:
Tools/Extensions/com.livecode.library.json/module.lcm
If you use revIgniter create a folder “extensions” in your
application folder and place the “com.livecode.library.json”
folder including the “module.lcm” file there.
Then load the extension in your controller using:
rigLoadExtension "com.livecode.library.json"
and you are done, see:
https://revigniter.com/userGuide/general/extensions.html
Ralf
On 18. Nov 2017, at 00:53, Alex Tweedly via use-livecode
<use-livecode@lists.runrev.com> wrote:
But - still need to solve the problem of my database interactions - which I
want to do through revIgniter, rather than through my little utility script for
doing the actual upload. No problem - just take the rest of the data, stick in
a JSON-encoded cookie, and redirect back to the revIgniter script on success.
That's when I ran into the problem that aArrayToJSON() isn't (automatically)
available on LCServer. Fortunately Devin has given me an answer to that
(Thanks!!) so I should be back on track in another hour or two ..
_______________________________________________
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
_______________________________________________
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