How to format the received JSON to make it look beautiful?

json formatter
json beautifier
json validator
json pretty-print python
json viewer
json format example
json parser
json converter

I get an array of objects and display it on the screen, but the data is not beautiful, how to format to have indents and everything was beautiful, tell me how to do this using js or some kind of library.

const express = require('express');
const Database = require('./db');

const app = express();
const port = 3000;
const db = new Database();


app.get('/gallery', (req, res) => { => {
        const pictures = JSON.parse(data);


res.send(JSON.stringify(pictures, null, 4);    // stringify with 4 spaces at each level

Taken from here

Either format from backend or from client side using JSON.stringify

JSON.stringify takes more optional arguments.

I recommend formaingt it in client side, as you can use the original JSON for rendering the page.

JSON Tutorial: Learn with simple EXAMPLE, , that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types (or any other serializable value). JSON Formatter bueatifies (formats) the JSON string in readable and colored format. Output is easy to read by humans to understand large JSON string in few seconds. Colors used in JSON Formatter 's output are similar to colors of codes in different IDEs and Text Editors.

Human readable

Actually I am not sure why would we display data in Json format to the user, But it's your requirement, so i will roll with it.

There are useful answers and comments that gives you what you want, to display the json well formatted on the screen.

This answer intends to add bit of an edge if you want to display the json data in actual human readable form in an easy way. You can use this if you find necessary.


It takes json input and gives you a structured data as output. Example below:


JSON, Here, an associative array is declared to generate JSON data. No formatting is applied for JSON data in the code. So, JSON data will be printed in a single line  JSON tree viewer or call it JSON beautifier online is a tool that you can use to make your work look pretty. So, you don’t find it difficult to read or make modifications, and the primary purpose is to save your time from looking for a specific part to alter in the code of JSON.

you can use JsonLint to beautify your json

pretty-print JSON using JavaScript, You are here: Home / Python / JSON Pretty Print using Python- with Examples Python generates dynamic JSON string and received by the client. create Python objects and dumps the JSON data in beautiful JSON String. Ln:1 Col:1. 0 characters selected. Welcome to the online JSON Viewer, JSON Formatter and JSON Beautifier at JSON is a data format that is gaining popularity and used extensively in many AJAX powered Web sites. Many websites which offer API's, which will return data in JSON format.

JSON Formatter & Validator, received from somewhere: An HTTP response you need to look at Here's a small tip that makes it easy to take a JSON string and prettify it But assume for a second that you are getting data already in string format from In practice, it's nice if you have any interfaces that need to display JSON in the UI. JSON or JavaScript Object Notation is a language-independent open data format that uses human-readable text to express data objects consisting of attribute-value pairs. Although originally derived from the JavaScript scripting language, JSON data can be generated and parsed with a wide variety of programming languages including JavaScript, PHP

How to read and print pretty JSON with PHP – Linux Hint, Format. I have shown you how to make Ajax calls between the client and the server with To be fair, JSON is pretty new, and the industry is already adopting it. Online JSON Formatter and Online JSON Validator also provides tools to convert JSON to XML, JSON to CSV, JSON Editor, JSONLint , JSON Checker and JSON Cleaner.. JSON Formatter Online and JSON Validator Online work well in Windows, Mac, Linux, Chrome, Firefox, Safari, and Edge and it's free.

JSON Pretty Print using Python- with Examples, Format. I have shown you how to make Ajax calls between the client and the server with To be fair, JSON is pretty new, and the industry is already adopting it. The FormatFilter looks for a route parameter called format in the RouteData for the request, or in the querystring. If you want to use the .json approach I described earlier, you should make sure the route template for your actions includes a .{format} parameter:

  • there are some extension available for chrome use it. for ex:…
  • JSONView is also a good alternative
  • Where's this 'on the screen'? Is it how it appears in browser window?
  • @estus yes, this is screen in browser window
  • Umm... set the content-type to aplication/json and let the browser handle formatting for you?
  • OP is asking for javascript code not an external website