Optionaloptions: EncodeOptionsFor functions, userdata, threads, NaN, ±Infinity, circular
references, keys that are neither strings nor positive integers, overly
sparse arrays and nesting beyond
maxDepth. The message includes the path to the offending value (with
0-based array indices), e.g. json.encode: cannot encode a value of type function at $.handlers[2].
Encodes a value as JSON text.
undefined/nil and NULL encode asnull; booleans, numbers and strings as themselves (strings are treated as UTF-8 and passed through).JSON.stringify({ 1: "a", b: 2 })does. Tables marked by asArray/asObject or produced by decode keep their kind.toJSON(key)method, if present, supplies the value to encode.