JSON Formatter
This is a light-weight JSON formatter which works on the client side. It is written in JavaScript and uses the JSON.parse() function to parse the JSON string and then uses the JSON.stringify() function to format the JSON object.
If the parse fails then it will attempty to format the object as best as possible with indents and line breaks to make it more readable.
Demo
You can view the live demo here.
Usage
- Paste your JSON string into the text area.
- See the formatted JSON object in the output area.
Example
Input
{ "name": "John Doe", "age": 30, "cars": { "car1": "Ford", "car2": "BMW", "car3": "Fiat" } }
Output
{ "name": "John Doe", "age": 30, "cars": { "car1": "Ford", "car2": "BMW", "car3": "Fiat" } }
Installation
- Clone the repository.
- Run
npm install
to install the dependencies. - Run
npm run dev
to start the development server. - Open your browser and navigate to the URL provided by the development server.