JSON.stringify() & Formatting
JSON.stringify() converts JavaScript objects to JSON strings. It's the opposite of JSON.parse().
Basic Usage
Pretty Printing
Use the third parameter to format output:
The Replacer Function
Filter or transform values during stringification:
Handling Special Values
Exercise: Format JSON
Exercise: Filter Properties
Key Points
JSON.stringify()converts objects to JSON strings- Use third parameter for pretty printing
- Replacer can filter or transform values
undefined, functions, and symbols are omittedNaNandInfinitybecomenull
Up next · Lesson 7 of 23
Handling Parse Errors
1 min read
6 of 23 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

