🎉 We're live on Product Hunt! Support us with your feedback
back

JSON Parser & Stringify

Convert between JSON strings and formatted objects with ease

Overview

The JSON Parser & Stringify tool helps you convert between JSON strings and JSON objects. It supports both parsing JSON strings into formatted objects and stringifying objects into JSON format.

JSON parse

Convert a JSON string into a formatted object. This mode helps you validate and format JSON strings.

Raw JSON string:

{\"name\":\"John Doe\",\"age\":30,\"isStudent\":false,\"hobbies\":[\"reading\",\"gaming\"],\"address\":{\"city\":\"New York\",\"country\":\"USA\"}}

Formatted JSON:

{
  "name": "John Doe",
  "age": 30,
  "isStudent": false,
  "hobbies": [
    "reading",
    "gaming"
  ],
  "address": {
    "city": "New York",
    "country": "USA"
  }
}

JSON stringify

Convert a JSON string into a formatted object. This mode helps you validate and format JSON strings.

JSON object:

const personData = {
  name: "John Doe",
  age: 30,
  isStudent: false,
  hobbies: ["reading", "gaming"],
  address: {
    city: "New York",
    country: "USA"
  }
};

Converting to JSON string:

// Minified JSON string (with escaped quotes)
const rawJson = "{\"name\":\"John Doe\",\"age\":30,\"isStudent\":false,\"hobbies\":[\"reading\",\"gaming\"],\"address\":{\"city\":\"New York\",\"country\":\"USA\"}}";

// Pretty-printed JSON string
const prettyJson = JSON.stringify(personData, null, 2);

Options

  • Indent Size: Choose between 2, 4, or 8 spaces for formatting
  • Escape Unicode: Convert Unicode characters to \uXXXX format
  • Remove Whitespace: Output minified JSON without spaces or newlines

Unstringify escaped JSON

Escaped JSON — also called stringified or double-encoded JSON — is a JSON document that has been stored inside a JSON string. Every quote becomes \" and every line break becomes \n. It appears whenever JSON passes through a system that treats it as plain text rather than structured data.

Where it comes from

  • Log lines that record a request or response body as a single string field
  • APIs that serialise a nested payload twice, so the value arrives as a string rather than an object
  • Database TEXT or VARCHAR columns holding a serialised document
  • Webhook payloads that wrap the original event inside an envelope
  • Values copied out of a debugger or browser devtools, which display them already escaped

How to unescape it

Paste the escaped string into the input and run Parse. One layer of encoding is removed and the result is pretty-printed. If the output is still a string full of backslashes, the document was encoded more than once — run Parse again on the result until real structure appears.

Escaped input:

"{\"order\":{\"id\":41,\"note\":\"line one\\nline two\"}}"

After parsing:

{
  "order": {
    "id": 41,
    "note": "line one
line two"
  }
}

Common escaping problems

Most parse failures come from a document that is nearly JSON rather than one that is badly formed. These are the cases that account for almost all of them.

The output is still one long escaped string

The value was encoded twice. Run Parse again on the result — each pass removes exactly one layer of encoding.

The text shows \n instead of line breaks

Inside a JSON string, \n is a two-character escape sequence, not a newline. Parsing converts it into a real line break; a find-and-replace on the raw text does not.

A value copied from a config file will not parse

JSON requires double quotes. Single-quoted keys and values are valid JavaScript but are not valid JSON.

Parsing fails with an unexpected token near the end

JSON does not allow a trailing comma after the last element of an object or array. JavaScript does, so hand-edited files often carry one.

A document copied from a word processor or chat app will not parse

Those applications replace straight quotes with typographic quotes, which JSON does not recognise. Retype the quotes or paste through a plain-text editor first.

The first character is reported as invalid but the file looks correct

The file begins with a UTF-8 byte order mark. Re-save it as UTF-8 without BOM.

Features

  • Parse JSON strings into formatted objects
  • Stringify JSON objects into JSON format
  • Configurable indentation (2, 4, or 8 spaces)
  • Unicode character escaping option
  • Error validation and helpful messages
  • Copy results to clipboard
  • Quick testing with example data

Tips & Tricks

  • Use the 'Load Example' button to see sample inputs
  • In Stringify mode, you can use JavaScript object notation with single quotes and unquoted keys
  • The tool automatically formats the output with proper indentation
  • Copy the output directly to clipboard with the copy button
  • Check error messages for validation issues in your input

Rocks Dev Dock Released 🥳

Press '+' inside the tool to add your favorite tools to your dock.

No data collection when you use our tools, just tools.