FormattersLesson 2Free preview
JSON Formatter
This lesson is part of Web Developer Tools · All levels
Summary
JSON Formatter adds indentations and new lines to the JSON text so that the structure is easy for humans to read. The data that was once piled in a single line will be broken down by property and by level. The content and order of the data remain unchanged; only the appearance is refined. This tool is very helpful when tracking API responses or long configuration files.
Key points
- Adding indentation and line break without changing the data value
- Useful for reading JSON results of typically compressed APIs
- JSON that is invalid will fail to be formatted and needs to be fixed first
- The number of indentation spaces can usually be adjusted, e.g. 2 or 4 spaces
- Save the neat version for reading, and the minified version for sending to production
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.