Smart JSON formatter
Recently, I stumbled upon the FracturedJsonJs library. It is an amazing JSON formatter. It formats your JSON data in a way that is easy for humans to read. Arrays and objects are written on single lines, as long as they're neither too long nor too complex. Also, arrays fields are aligned like a table. Long arrays are written with multiple items per line across multiple lines.
{
"SimpleArray": [2, 3, 5, 7, -11, 13, 17, 19, 23, 29, 31, -37, 41, 43, 47, 53, 59],
"ObjectColumnsArrayRows": {
"Katherine": ["blue" , "lightblue", "black" ],
"Logan" : ["yellow" , "blue" , "black", "red"],
"Erik" : ["red" , "purple" ],
"Jean" : ["lightgreen", "yellow" , "black" ]
},
"NestedAndVeryLong": {
"level1": {
"level2": {
"level3": {
"level4": { "level5": ["very", "long"] }
}
}
}
},
"ArrayColumnsObjectRows": [
{ "type": "turret" , "hp": 400, "loc": {"x": 47, "y": -4}, "flags": "S" },
{ "type": "assassin" , "hp": 80, "loc": {"x": 12, "y": 6}, "flags": "Q" },
{ "type": "berserker", "hp": 150, "loc": {"x": 0, "y": 0} },
{ "type": "pittrap" , "loc": {"x": 10, "y": -14}, "flags": "S,I" }
],
"ComplexArray": [ [19, 2], [3, -8], [14, 0], [9, 7] ]
}