Online JSON Formatter

Oct 9, 2021

JSON Formatter is an online tool to format JSON text, documents, or files. Our JSON beautifier indents JSON string and highlights the JSON syntax. The JSON Viewer shows the objects in a human-readable tree-like structure. You can quickly expand/collapse the nodes to get a concise view. You can also choose whether to convert the property names to the camel case. Convert dates in your JSON data to ISO or Microsoft date formats. Optionally, you can remove escape characters from the created JSON.



Input: Paste JSON text below

Settings

Minify, uglify or compress JSON text by removing unessential whitespace

View Tool

JavaScript Object Notation (JSON), pronounced as Jason, is the most common data interchange format on the web. Douglas Crockford first released the JSON specification in the early 2000s. It is a simple format that is easier to comprehend than XML. It is also smaller in size because it does not have closing tags. A wide variety of programming languages can parse JSON files. They also support the serialization of data structures to JSON. You can copy JSON text to JavaScript and start using them without any modifications.

JSON Validator

This tool also validates JSON. Invalid JSON data causes the formatting to fail. The error details, such as description, line number, and column number, are shown above the input text box.

Settings Explained
  • 1. Indent

    This setting governs whether or not the Output is indented. The indented Output is easier to comprehend. On the other hand, a non-indented output is compact. The smaller size is best for transmission over the network. So, we often minify JSON by removing non-essential whitespace. Indentation is the primary use of this tool. Users paste minified JSON and try to debug it by formatting and indenting.

    Indentation On

    {
      "name": "John Doe",
      "age": 69
    }
    Indentation Off

    {"name":"John Doe","age":69}
  • 2. Keys In Quotes

    A valid JSON must have double quotes around the keys (or property names). Unless the keys include special characters, double quotes are unnecessary when used directly inside JavaScript. Turn off this setting if you want to omit quotes around keys.

    Keys In Quotes On

    {"name":"John Doe","age":69}
    Keys In Quotes Off

    {name:"John Doe",age:69}
  • 3. Case Conversion

    Case is changed using one of the following styles before duplicate lines are removed

    The output will be changed depending on the case conversion rule selected.

    None

    No case Change
    Lower Case

    lower case change
    Upper Case

    UPPER CASE CHANGE
    Camel Case

    camelCaseChange
    Pascal Case

    PascalCaseChange
    Title Case

    Title Case Change
    Snake Case

    snake_case_change
    Sentence Case

    Sentence case change
    Kebab Case

    kebab-case-change
  • 4. Expanded Braces

    Braces are written on a new line (C# style) when this option is selected. Turning the option off puts the Braces on the same line (Java/JavaScript style).

    Expanded Braces On

    {
      "name": "John Doe",
      "age": 25,
      "addresses":
      [
        {
          "city": "Phoenix",
          "country": "Arizona"
        },
        {
          "city": "Miami",
          "country": "Florida"
        }
      ]
    }
    Expanded Braces Off

    {
      "name": "John Doe",
      "age": 25,
      "addresses": [
        {
          "city": "Phoenix",
          "country": "Arizona"
        },
        {
          "city": "Miami",
          "country": "Florida"
        }
      ]
    }
  • 5. Remove Escape Characters

    Use this setting to remove escape characters in JSON Formatter. It unescapes the input JSON by removing all backslash characters preceding a double quote. This removal is needed if your JSON input has been escaped and exists in the form of a string.

    Input
    "{\"personName\":\"John Doe\"}"
    Remove Escape Characters On
    {
      "personName": "John Doe"
    }
    Remove Escape Characters Off
    "{\"personName\":\"John Doe\"}"

    You cannot use this option along with Format Embedded JSON

  • 6. Format Embedded JSON

    When this option is selected, JSON embedded or escaped within string values is processed, expanded & converted to nodes.

    Format Embedded JSON On

    {
      "name": "John Doe",
      "age": 25,
      "addresses": [
        {
          "city": "Phoenix",
          "country": "Arizona"
        },
        {
          "city": "Miami",
          "country": "Florida"
        }
      ]
    }
    Format Embedded JSON Off

    {
      "name": "John Doe",
      "age": 25,
      "addresses": "[{\"city\":\"Phoenix\",\"country\":\"Arizona\"},{\"city\":\"Miami\",\"country\":\"Florida\"}]"
    }
  • 7. Date Format Handling

    Even though there is no standard for representing dates in JSON, two popular formats have emerged. The ISO Date Format is the most widely used. If you are using a .NET stack, quite possibly you are using the Microsoft Date Format.

    ISO Date Format

    {"systemTime":"2014-01-01T23:28:56.782Z"}
    Microsoft Date Format

    {"systemTime":"\/Date(1388618936782)\/"}
  • 8. Quote Character

    The custom quote character to use for wrapping string values and property names. You can choose between single quote ' and double quote "

    Quote Character: "

    {
      "name": "John Doe",
      "age": 69
    }
    Quote Character: '

    {
      'name': 'John Doe',
      'age': 69
    }
Comments 2

Sam Jaarsma

Sam Jaarsma Copy Link

  • one year ago

it's a shame that you do not support to convert camelCase to snake_case!

Partho Sarathi

Partho Sarathi Copy Link

  • one year ago

We just added case conversion for Lower, Upper, Camel, Pascal, Title, Snake, Sentence & Kebab cases.

History
Dec 1, 2018
Support for removing escape characters
Jun 29, 2018
Support for customizing quote character
New Data tools -
Sep 24, 2017
Support for embedded JSON formatting
Sep 23, 2017
Expanded brace style & setting to skip adding quotes around keys
Sep 19, 2017
Date format settings
Sep 2, 2017
Tool Launched