Friday, November 12, 2010

Converting plain string to dictionary

Hello,

I have a string as
s = "{a : b, c : 2}"

I want to convert this string to json object. There are no quotes
inside the string that means it's not like "{'a' : 'b', 'c' : 2}", so
when I tried to convert this string to json using eval() it's throwing
exception.

Please let me know if there is any other way to convert the plane
text / string into json?

Thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate