Logic Machine Forum
json.encode not working correctly - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: json.encode not working correctly (/showthread.php?tid=2050)



json.encode not working correctly - usyntax - 26.04.2019

Hello,

How i can use json.encode() function? I tried use this script:

Code:
test = {
  one='first',two='second',three={2,3,5}
}

jsonTest = json.encode(test)



but i get error: 

Code:
attempt to index global 'json' (a nil value)
stack traceback:
User script:37: in main chunk



RE: json.encode not working correctly - admin - 26.04.2019

You are probably missing require('json') at the beginning of your script.