JSON Formatter

The JSON Formatter can be used to convert JSON to one line or format it using a specified level of indentation. More.

This is a client-side utility. Your data will NOT leave your own browser.

How it works?

JSON Formatter online: The JSON Formatter can be used to convert JSON to one line or format it using a specified level of indentation.

  • Single line: Convert the JSON to single line result, removing all spaces. Transforming the JSON to one line can be useful in various development activities.
  • 2, 3 and 4 spaces and Tabs: Formats the JSON using a specified level of indentation.

See the examples of usage below.

Examples

Unformatted JSON
{ "note": {"from": "Jessy", "to": "Joe", "title": "Water bill", "body": "Do not forget the water bill this week!" } }
Formatted JSON (2 spaces indentation)
{
  "note": {
    "from": "Jessy",
    "to": "Joe",
    "title": "Water bill",
    "body": "Do not forget the water bill this week!"
  }
}
Formatted JSON
{
  "note": {
    "from": "Jessy",
    "to": "Joe",
    "title": "Water bill",
    "body": "Do not forget the water bill this week!"
  }
}
Single line JSON (unnecessary spaces removed)
{"note":{"from":"Jessy","to":"Joe","title":"Water bill","body":"Do not forget the water bill this week!"}}

Tutorials

How to format JSON to one line

Follow these steps to quickly format your JSON to one line.
  1. Prepare your JSON input
    • Have your JSON text in a valid format ready to be used.
  2. Enter the data
    • Paste your well-formed JSON into the input area.
  3. Select the formatting option
    • Click on the "Options" button and select the "Single line" item.
  4. Submit
    • Click the "Submit" button. You should now see the output formatted accordingly to the selection.
  5. All done
    • Your JSON is ready. Click the "Copy to Clipboard" button and you should be ready to rock!

More information

What is it?

JSON (JavaScript Object Notation) is an alternative to XML, which is also an open standard format that uses human-readable text to describe data objects consisting of attributes and values.

The JSON data structure is less verbose than XML, and still simple, so it has been adopted as the first option for projects that requires data transportation, since it tends to have a better performance and consumes less bandwidth.

JavaScript:

Although the JSON syntax resembles and it is actually based on JavaScript (no surprise), this data format can be used in any programming languages. In fact, every popular programming language will commonly provide some sort of support for dealing with JSON data.

JSON structure:

  • An object in JSON starts and ends with ‘{‘ and ‘}’ respectively. Between the brackets, it has a number of string value pairs
  • The String (attribute name) is separated from the value with a ‘:’
  • Arrays are stored within square brackets: ‘[’ and ‘]’
  • Values inside a JSON object can be of the following types: String, Number, Object, Array, True, False or Null
  • A String value can contain a collection of none or more UNICODE characters (excepted double quotes, ‘\’ or control chars), enclosed by double quotes.

JSON and databases:

With so much popularity, JSON became a format commonly supported not only by NoSQL databases (such as MongoDB, Neo4J, Firestore, etc.) but also by traditional SQL databases including Oracle, MySQL and PostgreSQL to mention a few. The features provided by some of these databases include the capability of querying, indexing and others, so it is not just a plain text stored in the database!

Looking for something else?

In case you are looking for something else than this functionality, please let us know by contacting us. The most common requests will be made available (for free) once possible.