JSON: Difference between revisions

Line 2,525:
print("JSON from new Lua data: " .. json.encode(data))</lang>
 
Since in Lua <code>nil</code> signifies an ''undefined'' value, i.e. a variable or table entry with a <code>nil</code> value is undistinguishabletreated fromas the same as an undefined variable or non-existing table entry, a <code>null</code> value in JSON notation is decoded to a special function value, which ensures that it can be re-encoded properly to <code>null</code> again.
To manually insert a <code>null</code> value in the JSON output,
use the <code>json.util.null</code> function.
4

edits