JSON String Escape / Unescape

Escape and unescape strings for JSON. Safely convert special characters like newlines and double quotes, all processed inside your browser.

Last updated: 2026/10/16 Developer Feedback & bug reports
Input
Output

How to Use

1

Choose a Mode

Select "Escape" or "Unescape". Escape converts a normal string for JSON, while Unescape restores a JSON string back to plain text.

2

Enter Your String

Type or paste text into the input field and the result appears in real-time on the right (or below on mobile).

3

Adjust Options

When escaping, choose whether to add surrounding double quotes. Enable it when you want to paste the result directly as a JSON value.

4

Copy the Result

Click the copy button to copy the output with one click and paste it into your code or config file.

About JSON String Escaping

JSON string escaping converts special characters such as newlines, tabs, double quotes ("), and backslashes (\) into JSON-compliant sequences (\n, \t, \", \, etc.). This lets you safely embed any text as a JSON value. This tool processes everything in your browser with JavaScript, so your text is never sent to a server.

Features

  • Two-way ConversionSupports both escape and unescape. Swap the direction with one click.
  • Real-time ProcessingSee the result instantly as you type. No waiting required.
  • Quote OptionChoose to include or omit the surrounding double quotes to fit your use case.
  • Privacy ProtectedAll processing happens in your browser. Text is never sent to servers.

Use Cases

  • Embed strings with newlines or quotes into JSON values
  • Put long text into an API request body
  • Write sentences or paths into a JSON config file
  • Restore escaped strings from logs or JSON responses for readability
  • Create and verify string literals in your code

FAQ

Is the JSON string escape tool free to use?
Yes, it is completely free. No registration required. Just open it in your browser and start using it.
Which characters are escaped?
Double quotes ("→\"), backslashes (\→\), newline (\n), carriage return (\r), tab (\t), backspace (\b), and form feed (\f), as defined by the JSON spec. Control characters at or below U+001F are converted to \uXXXX form.
What is the surrounding quotes option for?
When using a string as a JSON value, it must be wrapped in double quotes. Enable the option to output it as "..." so you can paste it directly into JSON. Disable it if you only want the escaped content.
Why does unescape fail?
Unescape fails when the input is not a valid JSON string, for example an unterminated quote or an invalid escape sequence (such as \x). The tool automatically detects whether surrounding quotes are present.
Is my text sent to a server?
No, your text is never sent to or stored on any server. All conversions run locally in your browser (JavaScript), so it is safe to use even with confidential strings.