5 hands-on exercises and 5 find-the-bug challenges for the JavaScript JSON lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Stringify a person object and show the text.
Parse a JSON string and show the name from it.
Stringify then parse an object and show the year.
Copy a nested object through JSON, change the copy, and show the original city.
Wrap a parse in a try block and report when the text is not valid.
An object needs turning into text, not the other way round.
A JSON string has no properties until it is parsed.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceSpread shares the nested object, so the original was changed too.
Invalid text throws, so the parse needs a try block.
JSON requires double quotes around every key and string.