JSON Escape

Turn any text into a valid JSON string: double quotes, backslashes, new lines and tabs are escaped exactly as JSON requires. Paste a paragraph, an HTML snippet, a Windows path or a multi-line message template and get a value you can drop into a JSON file or API request without breaking it.

Action
Text
JSON string

Processing runs in your browser. What you type never leaves this device.

Features

  • Escapes " \ new lines, tabs and control characters

  • With or without the surrounding quotes

  • Optional \uXXXX for every non-ASCII character

  • Reverse button to unescape

  • Runs in your browser

When you need to escape text for JSON

API request bodies

Put a multi-line WhatsApp or email template into a JSON payload without hand-escaping each line break.

Config files

Store HTML, regex patterns or Windows paths (C:\\Users) in JSON config safely.

Code generation

Create string literals for JavaScript, which shares JSON's escaping rules.

What JSON escapes

The required escapes

  • " becomes \" and \ becomes \\.
  • New line, carriage return and tab become \n, \r and \t.
  • Other control characters become \u00XX.
  • Everything else, including Hindi and emoji, is allowed as is. Tick the ASCII option if the receiving system cannot handle UTF-8.

Related tools

JSON unescape reverses this. For escapes in other formats see the Unicode escape converter and HTML encoder.

JSON Escape - FAQ