bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/JavaScript/Objects, Classes, and Advanced Patterns
JavaScript•Objects, Classes, and Advanced Patterns

JSON Data Types

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind JSON Data Types?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

{"___":"John"}
3Order

Put the learning moves in the order that makes the concept easiest to apply.

JSON values cannot be one of the following data types:
- a string - a number - an object (JSON object) - an array - a boolean - null
In JSON, values must be one of the following data types:

Valid Data Types

In JSON, values must be one of the following data types:

  • a string
  • a number
  • an object (JSON object)
  • an array
  • a boolean
  • null

JSON values cannot be one of the following data types:

  • a function
  • a date
  • undefined

JSON Strings

Strings in JSON must be written in double quotes.

Example

{"name":"John"}

JSON Numbers

Numbers in JSON must be an integer or a floating point.

Example

{"age":30}

JSON Objects

Values in JSON can be objects.

Example

{
"employee":{"name":"John", "age":30, "city":"New York"}
}

Objects as values in JSON must follow the JSON syntax.

JSON Arrays

Values in JSON can be arrays.

Example

{
"employees":["John", "Anna", "Peter"]
}

JSON Booleans

Values in JSON can be true/false.

Example

{"sale":true}

JSON null

Values in JSON can be null.

Example

{"middlename":null}

Previous

JSON vs XML

Next

JSON.parse()