JSON Formatter / Beautifier
Format JSON file for better readibility and consistent
JSON Formatter / Beautifier / Prettier
What is JSON ?
JSON (JavaScript Object Notation) is a file format or structure that uses human-readable text for transmitting data or objects such as text, number, list, object( yes, javascript object), and others.
JSON object is native in Javasscript and can be seen as key - value pair. JSON is pretty common object used to send data over the internet. JSON to Javascript Object called parse, and Javascript Object to JSON called stringify.
Sample of JSON Formatted Text :
{
"name" : "doggy",
"skills" : [
{"duration":5, "name":"bark"},
{"duration":2, "name":"smile"},
{"duration":99999, "name":"loving"},
]
}
Difference between JSON and JSON5
JSON5 is a proposed extension to JSON that aims to make it easier for humans to write and maintain.
Example for JSON
{"a":1,"b":2} -> allowed
{a:1,b:2} -> not allowed
Example for JSON5
{"a":1,"b":2} -> allowed
{a:1,b:2} -> allowed
Why you need to format the JSON ?
Formatted JSON will be easier to read, especially by the programmer. Hence the debugging or collaboration process can be much faster.
We can see that most website use minified JSON to save disk space and bandwidth when sending data. So the rule of thumb is for development we use formatted/pretty JSON, and for production we use minified JSON.