JSON: Difference between revisions

Content added Content deleted
Line 270: Line 270:


Because most of JSON is valid Python syntax (except "true", "false", and "null", and a few obscure escape sequences), it is also possible (but not recommended) to parse JSON using eval():
Because most of JSON is valid Python syntax (except "true", "false", and "null", and a few obscure escape sequences), it is also possible (but not recommended) to parse JSON using eval():
<lang python>
<lang python>>>> true = True; false = False; null = None
>>> true = True; false = False; null = None
>>> data = eval('{ "foo": 1, "bar": [10, "apples"] }')
>>> data = eval('{ "foo": 1, "bar": [10, "apples"] }')
>>> data
>>> data