Skip to content
My Tiny Utils

Search tools

Type to find a tool, then press Enter to open it.

JSON Escape / Unescape

Escape text into a safe JSON string literal, or unescape a JSON string back to plain text. Handles quotes, newlines, and Unicode.

Processed locally in your browser — nothing is uploaded.

JSON Escape / Unescape

0 characters

Escaped

Output appears here…

About JSON Escape / Unescape

Escaping turns arbitrary text — quotes, newlines, tabs, Unicode — into a valid JSON string literal you can embed in a document or code. Unescaping reverses it, turning an escaped JSON string back into readable text.

Common uses

  • Embed a multi-line string (like a certificate or template) into a JSON config
  • Decode an escaped string copied from a log or API response
  • Put JSON inside JSON without breaking it

Example

Input

Line "one"
Line two

Output

"Line \"one\"\nLine two"

Frequently asked questions

When do I need to escape a string for JSON?

Whenever you embed text containing double quotes, backslashes, or line breaks inside a JSON document — a certificate, a template, an error message, or another JSON snippet. Unescaped, those characters would terminate the string early and break the document.

Which characters have to be escaped in a JSON string?

Double quotes become \", backslashes become \\, and control characters use sequences like \n, \t, \r, or \uXXXX for anything else below U+0020. Everything else, including accented letters and emoji, can appear literally.

Does this tool send my text anywhere to process it?

No. Escaping and unescaping happen in your browser using JavaScript's own JSON functions, so certificates, keys, or log lines you paste never leave your device.

Why does unescaping fail with an invalid escape sequence error?

JSON only permits the escapes \" \\ \/ \b \f \n \r \t and \uXXXX with exactly four hex digits. A stray backslash before any other character — common when a string was escaped for a different language — makes the literal invalid.

Do I include the surrounding quotes when unescaping?

Either works. The tool accepts an escaped string with or without its enclosing double quotes and tries both interpretations before reporting an error.