Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

python convert object to json

# if you're not using a class for your json you can just do this
jsonStr = json.dumps(jsn)

# if you want to serialize a class then you need to add the __dict__
jsonStr = json.dumps(jsn.__dict__)
Source by pythonexamples.org #
 
PREVIOUS NEXT
Tagged: #python #convert #object #json
ADD COMMENT
Topic
Name
4+6 =