Advertisement
KodingKid

Name, age, and, location in JSON-to-Python

May 2nd, 2021
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. import json
  2. person1 = '{ "name":"Ben", "age":"49", "city":"Napoli" }'
  3. person2 = '{ "name":"Emily", "age":"24", "city":"Milano" }'
  4. x = json.loads(person1)
  5. y = json.loads(person2)
  6. print(person1["city"])
  7. print(person2["name"])
  8. print(person1["age"])
  9. print(person2["age"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement