json beutify code example

Example 1: js json stringfy beutify

JSON.stringify(obj, undefined, 2);

Example 2: online json viewer

Online JSON beautifier: https://codebeautify.org/jsonviewer

JSON pretty print in Python:

import json
your_json = '["foo", {"bar":["baz", null, 1.0, 2]}]'
parsed = json.loads(your_json)
print(json.dumps(parsed, indent=4, sort_keys=True))

Example 3: json beautify

fetch('https://fakestoreapi.com/products')
            .then(res=>res.json())
            .then(json=>console.log(json))

Example 4: json beautify

fetch('https://fakestoreapi.com/products/6',{
            method:"DELETE"
        })
            .then(res=>res.json())
            .then(json=>console.log(json))

Example 5: json beautify

fetch('https://fakestoreapi.com/products/1')
            .then(res=>res.json())
            .then(json=>console.log(json))