Tuesday, 26 July 2022

python django convert json string to list

https://www.w3schools.com/python/python_json.asp


https://pythonexamples.org/python-json-to-list/#:~:text=To%20convert%20a%20JSON%20String,and%20returns%20a%20Python%20List.

import json

# some JSON:
x =  '{ "name":"John", "age":30, "city":"New York"}'

# parse x:
y = json.loads(x)

# the result is a Python dictionary:
print(y["age"])


json.dumps(xxx) convert python list/dict to json string

No comments:

Post a Comment