What JSON is, how an object is written, and the two mistakes everybody makes at first.
Your first objectTry itA JSON object is a set of "name": value pairs between { and }.
Add more factsExercisePairs are separated by commas. Numbers have no quotes; text always has double quotes.
The name without quotesDebugIn JSON, names always have double quotes: "name", never name.
One comma too manyDebugNo comma after the last pair (or the last item in a list). It is the most common JSON mistake in the world.
Quick checkQuizObjects: {}, pairs: "name": value, commas between pairs, never after the last.
2. Six kinds of values
Text, numbers, true and false, null, and objects inside objects. Each one has its own rules.
Meet every typeTry itSix types: text, number, true/false, null, object and list. Only text has quotes.
A settings fileExercisetrue, false and null are words without quotes. "true" in quotes would just be text.
True or true?Debugtrue, false and null are always lowercase in JSON.
Numbers are not textExercise25 is a number. "25" is text. Programs treat them very differently.
Quick checkQuizText in quotes, numbers without, and the words true, false and null in lowercase.
3. Lists and nesting
Lists hold many values in order, and objects can live inside objects. This is how real data is shaped.
Your first listTry itA list is [a, b, c]: values in order, commas between, none after the last.
A leaderboardExerciseA list of objects with the same names is the shape of almost every list in an app: users, posts, songs, scores.
The missing commaDebugList items, like object pairs, are separated by commas.
Objects inside objectsExerciseObjects and lists can hold other objects and lists, as deep as you need.
Quick checkQuizLists [ ] for many things, objects { } for one thing, and both can nest.
4. JSON in real apps
Your JSON powers little apps here: a profile card, a playlist, a weather widget and a shop. Change the data, and the app changes.
Power a profile cardTry itApps draw what the JSON says. Change the data, and the screen follows.
Build a playlistExerciseA list of objects plus a few fields around it: the shape of a playlist, a feed, a shopping cart.
Answer like a weather APIExerciseAn API answer is just JSON with an agreed shape. When both sides agree on the shape, they can talk.
The shop that would not openDebugOne small JSON mistake breaks the whole file, and the app gets nothing. That is why valid JSON matters.
Quick checkQuizApps load JSON and draw it. One agreed shape, zero mistakes, and everything works.
5. JSON exam
Eight questions about everything in this course. Pass with 6 right answers.
The JSON examExamYou can read, write and fix JSON, and shape data the way real apps and APIs do.
6. Final project
Design the data for an app of your own, and send it for review. A real person checks it and answers you.
The data for your own appFinal projectDesigning the data is the first step of every real app. You just did it.
How the course works
You learn by doing: each lesson explains one idea, then you write real code in the editor and see the result right away. The first lesson is free to try without an account; sign up to save your progress and continue.
Try it
Change working code and see the result immediately.
Exercise
Complete a task. A checklist confirms each requirement as you type.
Debug
Fix code that is broken on purpose, and learn why it failed.