http://stackoverflow.com/questions/1083250/running-json-through-pythons-eval
On Mar 22, 2014 7:48 PM, "Rajiv Subramanian M"
wrote:
> Hi dhuruv,
>
> I know null cases exists. I will throw an exception "UN defined variable
> null". But you can solve it by declare a variable
>
> null = None
>
> Then
Hi dhuruv,
I know null cases exists. I will throw an exception "UN defined variable
null". But you can solve it by declare a variable
null = None
Then execute the eval command. Any issues?
___
BangPypers mailing list
BangPypers@python.org
https://mail.
eval will not work always, especially when you have "null" values.
In [1]: eval('{"a": null}')
---
NameError Traceback (most recent call last)
in ()
> 1 eval('{"a": null}')
in ()
NameErr
)
>2. Re: JSON PARSER (Rajiv) (Jayanth Koushik)
>
>
> ------------------
>
> Message: 1
> Date: Fri, 21 Mar 2014 15:26:37 +0530
> From: Rajiv Subramanian M
> To: bangpypers@python.org
> Subject: Re: [BangP
Hi Rajiv
eval does not work with duplicates.
>>> eval("{'a': 1, 'b': 2}")
{'a': 1}
On Fri, Mar 21, 2014 at 3:26 PM, Rajiv Subramanian M
wrote:
> why not use 'eval' keyword for parsing json..
>
> Here is an example.
>
> *with 'eval' *
>
> json_data ='''
> {
> "firstName": "John",
> "las
Sorry, I meant:
>>> eval("{'a': 1, 'a': 2}")
{'a': 2}
On Fri, Mar 21, 2014 at 3:31 PM, Jayanth Koushik wrote:
> Hi Rajiv
>
> eval does not work with duplicates.
>
> >>> eval("{'a': 1, 'b': 2}")
> {'a': 1}
>
>
> On Fri, Mar 21, 2014 at 3:26 PM, Rajiv Subramanian M <
> rajiv.m1...@gmail.com> wrot
why not use 'eval' keyword for parsing json..
Here is an example.
*with 'eval' *
json_data ='''
{
"firstName": "John",
"lastName" : "Smith",
"age" : 25,
"address" :
{
"streetAddress": "21 2nd Street",
"city" : "New York",
"state":