DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

JSON, short for JavaScript Object Notation, is
pronounced like the name “Jason.” The JSON format is
derived from JavaScript object syntax, but it is entirely
text based. It is a key: value data format that is typically
rendered in curly braces {} and square brackets []. JSON
is readable and lightweight, and it is easy for humans to
understand.


A key/value pair has a colon (:) that separates the key
from the value, and each such pair is separated by a
comma in the document or the response.


JSON keys are valid strings. The value of a key is one of
the following data types:


String
Number
Object
Array
Boolean (true or false)
Null

Example 7-2 shows a sample JSON response document,
and you can see the full response. If you are interested in
seeing the status of the lights in the study_room, then
you look at all the values that are present and follow the
various key/value pairs (such as “lights”: “On”) and
extract the various values from the response by locating
the correct keys and corresponding values.


Example 7-2 JSON Data Format

{
"home": [
"this is my house",
"located in San Jose, CA"
],
"rooms": {
"living_room": "true",
"kitchen": "false",
"study_room": [
{
"size": "20x30"
Free download pdf