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

