Learn JSON
Guide 1: How to Learn JSON for Beginners: Syntax, Errors and ParsingGuide 2: How to Learn to Use an API with fetch: A Simple PlanA small course in 8 short lessons on JSON, the text format that websites and apps use to send data to each other. You write objects, text and numbers, true, false and null, arrays and nested data, and you fix JSON that is broken. In the first seven lessons your text is checked by a real JSON parser in your browser, so a missing quote or a comma too many is found, and you see the message of your browser. The last lesson is about JSON.parse and JSON.stringify in JavaScript and is checked with a pattern. Your text stays in your browser and your progress is remembered there.
Lessons 1 to 7 really parse your text as JSON in your browser, so a missing quote or an extra comma is found. Lesson 8 is JavaScript and is checked with a pattern, because the code is not run.
0 of 8 lessons done. Your progress is saved in this browser.
1. An object with a key and a value
JSON is a text format for data. The basic building block is an **object**: curly braces around pairs of a key and a value, with a colon between them. The key is always text in double quotes.
Your task: Write an object with the key name and your own name as the value, in double quotes.
What you type stays in this browser. It is not saved or sent anywhere.
Features
- 8 short lessons, from a single object to fixing broken JSON
- Your JSON is checked by a real parser, with the message of your browser
- A hint and the model answer for every lesson
- Your progress is remembered in this browser
How to use Learn JSON
- Read the lesson and the task.
- Write your JSON in the editor.
- Press Check my answer. Use the hint or the answer if you are stuck.
- Go to the next lesson.
Frequently asked questions
Is my JSON really checked?
Yes, for the first seven lessons. Your text is read with the JSON parser of your browser, so an error such as a missing quote or a trailing comma is found. Then the course checks that the data has what the task asks for. The last lesson is JavaScript and is checked with a pattern, because the code is not run.
Why do I see an English error message?
The message comes from the JSON parser of your browser, not from this course, so it can be in English and can differ per browser. It names the position of the first mistake, which is a good place to start looking.
What is the difference between JSON and a JavaScript object?
JSON is text with strict rules: keys and text in double quotes, no trailing commas, no comments and no functions. A JavaScript object is a value in a running program. JSON.parse turns JSON text into such a value and JSON.stringify does the opposite.
Is my text saved?
Only which lessons you finished is saved, in this browser. What you type is not stored or sent anywhere.