Skip to content
OnlineToolStudio

JSON Escape / Unescape

runs in your browserno sign-upfree

Escape text or JSON into a JSON string like JSON.stringify (quotes, backslashes, line breaks), or unescape a string back to formatted JSON.

Escaped

37 chars

About this tool

This tool escapes text so it can be placed inside a JSON string — double quotes, backslashes, line breaks, tabs and other control characters are turned into \" \\ \n \t and so on, exactly like JSON.stringify. Unescape does the reverse and turns an escaped JSON string back into plain text.

How to use

  1. Choose Escape or Unescape.
  2. Paste your text (or the escaped JSON string) into the input box.
  3. Optionally add the surrounding double quotes, or minify JSON first for a compact one-line string.
  4. Copy the result. Swap uses the output as the new input.

FAQ

Which characters are escaped?

Double quotes ("), backslashes (\) and control characters such as line breaks (\n), carriage returns (\r) and tabs (\t). Other characters, including emoji and accented letters, are valid in JSON and are kept as they are.

How do I turn an escaped JSON string back into JSON?

Choose Unescape and paste the string, e.g. "{\"name\":\"Asha\"}". With "Format result as JSON" ticked you get the object back, neatly indented. For PHP’s json_encode() and json_decode() — with flags, var_dump and print_r — use the PHP json_encode and json_decode tools.

Can I paste a string with its quotes when unescaping?

Yes. Both "Hello\nWorld" (with quotes) and Hello\nWorld (without) are unescaped correctly.

Why do I get "not a valid JSON string"?

The text contains a double quote that is not escaped, a lone backslash, or an escape JSON does not support such as \x41. JSON only allows \" \\ \/ \b \f \n \r \t and \uXXXX.

Is my JSON uploaded anywhere?

No. Everything runs in your browser, so API responses, config files and other data never leave your device. Your last input is saved only in this browser; press Clear to remove it.

Related tools

All tools