Run
import json # Given JSON string json_str = '[{"name":"Tesla", "age":2, "city":"New York"}, { "name":"Tesla", "age":2, "city":"Boston"}]' # Parse json string python_obj = json.loads(json_str) # Print types print("Type of python object :", type(python_obj)) print("Type of item in list :", type(python_obj[0])) # Access inner elements city = python_obj[1]['city'] print(city)
Output