Learn Quiz

JSON Quiz

Test your knowledge of the JSON format. — 8 questions

Question 1 of 8 Score: 0

About the JSON Quiz

Test your knowledge of the JSON format. This quiz has 8 multiple-choice questions. Each question has one correct answer, and you see an explanation straight after you answer, so you learn from every question — including the ones you get wrong. There is no time limit and nothing to sign up for; your answers are not stored.

The questions follow the material in the JSON Basics guide and the JSON cheatsheet. Read them first if you want to prepare, or take the quiz cold to find the gaps in what you know.

Questions in this quiz

Preview the questions below. Each answer and its explanation are hidden until you choose to reveal them, so you can still take the quiz above without spoilers.

1. Which of the following is valid JSON?

  1. { name: 'Alice' }
  2. { 'name': 'Alice' }
  3. { "name": "Alice" }
  4. { "name": Alice }
Show answer

Answer: C. { "name": "Alice" }
JSON requires double-quoted keys and string values. Single quotes and unquoted identifiers are not valid.

2. Which data type does NOT exist in JSON?

  1. null
  2. boolean
  3. undefined
  4. number
Show answer

Answer: C. undefined
JSON has no `undefined` type. It supports string, number, boolean, null, array, and object only.

3. Are trailing commas allowed in JSON?

  1. Yes, always
  2. Yes, only in arrays
  3. No, never
  4. Only in the last element
Show answer

Answer: C. No, never
Trailing commas are not valid JSON. { "a": 1, } will cause a parse error.

4. What does JSON stand for?

  1. Java Serialized Object Notation
  2. JavaScript Object Notation
  3. Java Standard Output Node
  4. JavaScript Open Network
Show answer

Answer: B. JavaScript Object Notation
JSON stands for JavaScript Object Notation, though it is language-independent.

5. What is a valid JSON root value?

  1. Must be an object
  2. Must be an array
  3. Can be any valid JSON value
  4. Must be a string
Show answer

Answer: C. Can be any valid JSON value
A JSON document can have any valid value at its root: object, array, string, number, boolean, or null.

6. How is null represented in JSON?

  1. "null"
  2. NULL
  3. null
  4. undefined
Show answer

Answer: C. null
In JSON, null is written as the bare keyword null (no quotes, lowercase).

7. Which is a valid JSON number?

  1. NaN
  2. Infinity
  3. 0xFF
  4. 3.14
Show answer

Answer: D. 3.14
JSON does not support NaN, Infinity, or hex literals. Only standard decimal numbers like 3.14 are valid.

8. In a JSON object, can two keys have the same name?

  1. Yes, both values are kept
  2. Yes, the last value wins (by convention)
  3. No, it is a syntax error
  4. Only if they have different types
Show answer

Answer: B. Yes, the last value wins (by convention)
The JSON spec technically allows duplicate keys but considers it undefined behavior. Most parsers keep the last value, but it should be avoided.

How to use this quiz

  • Answer every question before reading the explanations below — retrieving an answer from memory is what makes it stick.
  • Note the questions you missed and revisit the matching section of the guide or cheatsheet.
  • Retake the quiz a day or two later. Spaced repetition is one of the most reliable ways to remember technical details.

Related