Skip to content

JSON to String & String to JSON

Escape JSON into a string literal, or turn an escaped string from logs or APIs back into JSON.

Input JSON

String Output

About the JSON ⇄ String

Escape JSON into a single string you can embed in code, environment variables or another JSON field, or swap direction to unescape a string like "{\"id\":1}" back into clean JSON. Strings stringified more than once are unwrapped automatically.

How to use it

  1. Paste JSON to escape it, or press Swap and paste an escaped string to unescape it.
  2. The result appears as you type; Swap moves it into the input so you can convert it back.
  3. Use Options for the layout, quotes and Unicode escapes (or indentation when unescaping), then copy or download the result.

Frequently asked questions

What does JSON to String do?

It wraps your JSON in quotes and escapes everything inside, so {"a":1} becomes "{\"a\":1}", a valid string you can paste anywhere a string is expected.

Why is my JSON full of backslashes?

It was stringified, often by a logger or by storing JSON inside another JSON field. Swap to String to JSON to remove the escaping.

Do I need to include the outer quotes when unescaping?

No. Quoted and unquoted strings both work, as do single-quoted ones and strings stringified twice or more.

Related tools