parse JSON
converts a JSON string to a data structure
(string x, boolean lenient) -> any
Returns a value representing the encoded content of given JSON string x.
Returns nil if x is nil.
Parameters
| Name |
Type |
Description |
x |
string |
The JSON string to parse |
lenient |
boolean |
If true, non-standard JSON is parsed on a best-effort basis. Examples of non-standard formats that are likely to be successfully parsed in lenient mode include JSON with single-quoted strings and JSON with comments.
If false, only valid JSON strings are processed. An error is thrown if an invalid JSON string is encountered.
|