JSON+Data+Types+Handout
JSON+Data+Types+Handout
Key Terms:
JSON String Data Type: a string value, like “my string” surrounded in double quotes.
JSON Number Data Type: a number value, like 42, that can be a positive or negative integer,
decimal, or exponent.
JSON Array Data Type: An array is a collection or list of values and the values can have a data
type of string, number, boolean, object or array. The values in an array are surrounded by
square brackets([]) and delimited by a comma.
JSON Object Data Type: The object data type is a set of name/value pairs delimited by a
comma and surrounded by curly brackets ({}).
Key Points:
● The boolean data type value of true or false in JSON is always all lowercase characters
(like true, not True).
● The key difference between null in JSON and undefined in JavaScript is that null
represents an empty value and undefined represents and empty property and value (or
name/value pair).
● The null data type value in JSON is always all lowercase characters (like null, not NULL
or Null).
● One key difference between an object and an array is that an object is a list or collection
of name/value pairs where an array is a list or collection of values.
● Another key difference between an array and an object is that an array’s values *should*
all have the same data type.
Example:
{
"name": "Marie",
"age": 32,
"nickname": null,
"instructor": true,
"favorites": {
"color": "green",
"number": 5
},
"numbers": [
1,
2,
3
]
}