String to JSON Converter

string → json

Paste an escaped or stringified string and get formatted JSON back. Your browser parses it in this tab, so the text is never uploaded.

WorkspaceNothing is uploaded
0 B
0 B

About this string to JSON converter

Logs, API responses and database columns often hold JSON as a string, with every quote escaped and sometimes stringified twice. Paste that string into the left box and the tool removes the string layers, parses what is left and writes formatted JSON into the right box as you type.

It accepts a quoted string literal, the same text without its outer quotes, or JSON that is already valid. When the input cannot be parsed, the status line gives the line and column of the first character a JSON parser rejects, and Go to error selects it.

How to use it

01

Add the string

Paste it, type it, or open a .txt or .json file of up to 10 MB. You can also drop the file on the left box.

02

Choose the layout

Pick 2 spaces, 4 spaces, a tab or one minified line, and tick Sort keys A to Z if you want the keys in a fixed order.

03

Copy or download

Copy puts the JSON on your clipboard. Download .json saves it as converted.json, and only when you click.

What it does

  • Removes up to 10 layers of string encoding, so a payload that was stringified twice still comes out as an object.
  • Reads an escaped string with or without its surrounding quotes.
  • Converts as you type for input up to 500,000 characters. Longer input runs when you click Convert to JSON or press Ctrl+Enter.
  • Shows the top-level type, the number of keys or items, the nesting depth and how many string layers were removed.
  • Gives the line and column of the first invalid character and selects it in the input.

Specifications

Specification Details
Input Typed or pasted text, or a .txt or .json file up to 10 MB
Output JSON indented with 2 spaces, 4 spaces or a tab, or minified to one line
String layers removed Up to 10
Live conversion Up to 500,000 characters; longer input converts on click
Output file name converted.json
Library None. The browser's own JSON.parse and JSON.stringify do the work
Good to know

What this converter does not do

It parses strict JSON and nothing looser. A few things fall outside that.

No relaxed syntax

Single quotes, unquoted keys, trailing commas and comments are reported as errors. The tool does not repair them.

Large numbers lose digits

Numbers pass through JavaScript, so an integer beyond 9007199254740991 or a very long decimal comes back rounded.

Duplicate keys collapse

When an object repeats a key, only the last value is kept, as JSON.parse does.

Numeric keys move to the front

JavaScript lists keys that are whole numbers first, in numeric order, so an object with such keys comes back reordered.

A string of digits stays a string

The value "123" is kept as a string. Only a string that holds an object, an array or another quoted string is unwrapped.

Related tools

Frequently asked questions

No. Parsing and formatting use the JSON functions built into your browser, in this tab. The tool downloads no library and no request carries your text.

It is JSON that was turned into a string more than once, so its quotes carry one or more backslashes. The tool keeps parsing until it reaches an object or an array, for up to 10 layers.

The text breaks a JSON rule at the position shown. Common causes are single quotes, a trailing comma, an unquoted key, or a string cut off before its closing quote.

Sort keys A to Z puts the keys of every object in alphabetical order at every level, with uppercase letters before lowercase ones. Keys that are whole numbers come first, in numeric order. Array order is never changed.

A file you open can be up to 10 MB. Pasted text has no fixed limit, but above 500,000 characters the conversion runs only when you click the button.

Your text stays on your device

Your browser's own JSON functions parse the string in this tab. Nothing you paste or open is sent anywhere, and the tool downloads no library to do its work.