Menu
Coddy logo textTech

JSON - API Response

Lektion 3 von 10 im Kurs API in Python von Coddy.

API-Antworten liegen oft in einem Format namens JSON vor. 

JSON steht für JavaScript Object Notation. JSON ähnelt den nativen Dictionary-Datentypen von Python.

Diese API-Antworten sehen so aus:

{
	"errors": [
		{
			"status": "422",
			"source": {
				"pointer": "/data/attributes/firstName"
			},
			"title": "Invalid Attribute",
			"detail": "First name must contain at least two characters." 
    	}
    ] 
}

Sie können JSON genau wie ein Dictionary in Python manipulieren. 

challenge icon

Aufgabe

Einfach

Versuchen Sie angesichts des unten stehenden JSON-Codes, den Wert des Schlüssels "errors" auszugeben
Dafür müssen Sie ein besseres Verständnis dafür haben, wie Dictionaries funktionieren. 

Dies wird im Abschnitt über Dictionaries des Kurses Python Fundamentals behandelt.

Probier es selbst

json = {
    "errors": [
        {
            "status": "422",
            "source": {
                "pointer": "/data/attributes/firstName"
            },
            "title": "Invalid Attribute",
            "detail": "First name must contain at least two characters."
        }
    ]
}

### Write Your Code Below This Line

Alle Lektionen in API in Python