“Python JSON String to Object” Código de respuesta

Python JSON String to Object

import json

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

print(y["age"]) 
Anxious Ant

Python a Json

# a Python object (dict):
x = {
  "name": "John",
  "age": 30,
  "city": "New York"
}

# convert into JSON:
y = json.dumps(x)
Dead Dolphin

Respuestas similares a “Python JSON String to Object”

Preguntas similares a “Python JSON String to Object”

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código