Chrome Extension

Compress or minify JSON using Javascript

To compress or minify JSON using Javascript, you can use the below code.
var json_str = `[
    {
      "type": "people",
      "id": "30",
      "attributes": {
        "name": "John Deo",
        "age": 40,
        "gender": "male"
      }
    }
]`;

var minified_json = JSON.stringify(JSON.parse(json_str));
console.log(minified_json);
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Was this helpful?
0 Comments