Premium
Implement JSON.stringify
Challenge summary
Implement JSON.stringify from scratch so its output matches the built-in method for primitives, strings, arrays, objects, toJSON methods and the values JSON cannot represent.
What you'll practice
- Apply toJSON with the right key before choosing how to serialize a value.
- Decide when a value becomes null, when it disappears and when serialization must throw.
- Escape strings for JSON, including control characters and lone surrogates.
- Tell a circular structure apart from an object that appears in several branches.
What Premium unlocks
Premium unlocks the runnable workspace, behavioral checks, implementation walkthrough, and edge-case discussion.
Free related practice
Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.
Premium is $24 a month or $99 a year, less in many countries.