simple code:
local encoded = '{"test":"He said \"Hello Guys\" to everyone"}' print(require("json").decode(encoded))
it prints to the console:
nil 19 '}' expected at line 1, column 19
Am I doing something wrong or is this a bug?
simple code:
local encoded = '{"test":"He said \"Hello Guys\" to everyone"}' print(require("json").decode(encoded))
it prints to the console:
nil 19 '}' expected at line 1, column 19
Am I doing something wrong or is this a bug?
Hi Renato,
With quotation marks, you should use:
local encoded = " { \"test\" : \"He said \\\"Hello Guys\\\" to everyone\"}"
Wow, I don’t believe that would be the standard JSON format to represent that, right?
But it works. Thanks @khanh.dq
No, it’s not because of the standard JSON format. You need to add ‘’ character because you wrote that string in your code files. It won’t be needed if you read and decode string from text file.
Hi Renato,
With quotation marks, you should use:
local encoded = " { \"test\" : \"He said \\\"Hello Guys\\\" to everyone\"}"
Wow, I don’t believe that would be the standard JSON format to represent that, right?
But it works. Thanks @khanh.dq
No, it’s not because of the standard JSON format. You need to add ‘’ character because you wrote that string in your code files. It won’t be needed if you read and decode string from text file.