← QCE Digital Solutions Unit 3

JSON files: structure

JSON stores data as key-value pairs inside curly braces, with lists in square brackets. Objects can nest inside each other, so programs can read it easily. It is a lighter alternative to XML.

Understanding JSON files: structure in QCE Digital Solutions Unit 3

What it does: The value of the key student is itself an object in curly braces, which is nesting. The square brackets hold a list of objects with no closing tags, so JSON is lighter and shorter than the XML version. The text before the colon is the key and the text after it is the value. So "year" is the key and 12 is its value. An array of objects gives each student their own object, and every object has the same keys. Repeating a key inside one object is confusing and breaks the structure. JSON separates pairs with commas, and a trailing comma after the last pair is not allowed. Semicolons are not used.

Common mistakes: A JSON key and its value are separated by a colon, not an equals sign. It should be "name": "Ava",. JSON keys must be wrapped in double quotes. It should be "student": "Liam",.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 194–250) and word search (Modules 194–337).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which JSON object is written correctly?
{"name": "Ava", "year": 12}{name = "Ava", year = 12}
Matches
{name: "Ava", "year": 12}
↓
The key name is not wrapped in double quotes. Every JSON key must be a double-quoted string.
Applying
Meanings
Term
{"name": "Ava", "year": 12}
Meaning
JSON stores data as key-value pairs inside curly braces, with lists in square brackets. Objects can nest inside each other, so programs can read it easily. It is a lighter alternative to XML.
Practice
{
Testing
Gaps
{"name": "Ava", "year" 12}
Check Answer
Spots
1{
2 "name" = "Ava",

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Zebra' badge — Pattern Matcher, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which JSON object is written correctly?
A. {"name": "Ava", "year": 12} ✓
B. {name = "Ava", year = 12}
JSON objects use curly braces, with each key in double quotes followed by a colon and then its value.
2. In the JSON {"name": "Ava", "year": 12}, what is "year"?
A. A key, paired with the value 12 ✓
B. A value, paired with the key 12
The text before the colon is the key and the text after it is the value. So "year" is the key and 12 is its value.
3. Which brackets does JSON use to hold a list of items?
A. Curly braces { }
B. Square brackets [ ] ✓
Lists (arrays) use square brackets. Curly braces are for objects made of key-value pairs.
4. A student file needs to hold many students, each with a name and a year level. Which structure fits best?
A. An array of objects: [{"name": "Ava"}, {"name": "Liam"}] ✓
B. One object that repeats the key: {"name": "Ava", "name": "Liam"}
An array of objects gives each student their own object, and every object has the same keys. Repeating a key inside one object is confusing and breaks the structure.
5. Which line is valid JSON?
A. {'student': {'name': 'Ava', 'year': 12}}
B. {"student": {"name": "Ava", "year": 12}} ✓
JSON needs double quotes around keys and text values. Single quotes are not valid JSON. An object can nest inside another object, as the student object does here.

Match the Pairs

{"name": "Ava", "year": 12} → A JSON object: curly braces hold key-value pairs separated by commas
"students": [{"name": "Ava"}, {"name": "Liam"}] → A key whose value is an array (list) of objects, written in square brackets
JSON can nest one object inside another to group related data → {"student": {"name": "Ava", "house": "Red"}}
JSON stores a list of records as an array of objects, while XML needs repeated opening and closing tags → [{"item": "Pencil"}, {"item": "Notebook"}]
{name: "Ava", "year": 12} → The key name is not wrapped in double quotes. Every JSON key must be a double-quoted string.
{"name": "Ava" "year": 12} → There is no comma between the two key-value pairs, so the file is invalid and a program cannot read it.

Key Term

{"name": "Ava", "year": 12}
JSON stores data as key-value pairs inside curly braces, with lists in square brackets. Objects can nest inside each other, so programs can read it easily. It is a lighter alternative to XML.

Fill in the Blanks

1. {"name": "Ava", "year": 12}
Hint: Type the single character that separates a key from its value.
2. {"name": "Ava", "year": 12}
Hint: Type the bracket that opens a JSON object.
3. {"students": [ {"name": "Ava"}, {"name": "Liam"}]}
Hint: Type the bracket that starts a list of objects (an array).
4. {"name": "Ava", "address": {"city": "Cairns"}}
Hint: Type the bracket that starts an object nested inside another object.
5. XML: <year>12</year>
Hint: Type the element name that the closing XML tag must repeat.

Spot the Error

Question 1
A {
B "name" = "Ava",
C "year": 12
D }
Line B — A JSON key and its value are separated by a colon, not an equals sign. It should be "name": "Ava",
Question 2
A {
B student: "Liam",
C "house": "Blue"
D }
Line B — JSON keys must be wrapped in double quotes. It should be "student": "Liam",
Question 3
A {
B "id": 7,
C "points": 120,
D "house": "Red",
E }
Line D — The last key-value pair must not end with a comma, because nothing follows it before the closing brace. It should be "house": "Red"
Question 4
A {
B "name": "Mia",
C 'year': 11
D }
Line C — JSON requires double quotes around keys. Single quotes are not valid. It should be "year": 11
Question 5
A {
B "name": "Noah",
C "marks": {88, 74, 91}
D }
Line C — A list of values in JSON goes in square brackets, not curly braces. It should be "marks": [88, 74, 91]

Student with a class code? Join your class →