Python -JSON-Parsing
Analysieren Sie JSON - Konvertieren Sie von JSON in Python
Wenn Sie eine JSON-Zeichenfolge haben, können Sie sie mithilfe der
json.loads()
Methode parsen.
Das Ergebnis ist ein Python-Wörterbuch .
Beispiel
Von JSON nach Python konvertieren:
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"])