Decode
nil plus an error string if the text is not valid JSON.
Encode
nil plus an error string. Functions, userdata and threads cannot be encoded.
Object keys must be strings or numbers. Number keys are converted to strings.
null
json.null preserves JSON null values inside Lua tables and encodes back to null.
Empty tables
{} and [] both decode to an empty Lua table, and an empty table encodes to []. Use json.EmptyObject when a server needs {}.