Possible Duplicate:
Easy JSON encoding with Python
I want to get a record from database and built it in to json. I know we can do it with json_encode when using PHP. But how can we do it in Python
Possible Duplicate:
Easy JSON encoding with Python
I want to get a record from database and built it in to json. I know we can do it with json_encode when using PHP. But how can we do it in Python
# Python 2.6+
import json
result = json.dumps(value)
or
# Python 2.6+
import json
json.dump(value, out_file)
Got if from google first result. http://www.php2python.com/wiki/function.json-encode/
Please do your research before asking simple, searchable questions!
There are several json implementations for Python. I like simplejson because it's, well, simple.