Q:

python json string to object

import json

x =  '{ "name":"John", "age":30, "city":"New York"}'
y = json.loads(x)

print(y["age"]) 
8

  import json

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

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

x = {
  "name": 
  "John",
  "age": 30,
  "city": "New York"
}

y = json.dumps(x)
0

New to Communities?

Join the community