
JSON Escape / Unescape is a tool that converts arbitrary text into a form that is safe to place inside a JSON string value, and reverses the process. Escaping replaces the characters that would break a JSON string - the double quote, the backslash, and control characters such as newlines and tabs - with their backslash escape sequences (\", \\, \n, \t, and \uXXXX). Unescaping turns those sequences back into the original raw characters.
This is different from formatting or validating JSON. A JSON formatter works on the structure of a whole document; this tool works on the contents of a single string. You reach for it when you need to embed a block of text - an HTML snippet, a SQL query, a multi-line log message, a code sample - inside a JSON field, or when you have a JSON-escaped string and want to read the original text behind all the backslashes.
Everything runs 100% in your browser with a hand-written escaper, so the text you paste - which is often a payload, a config value, or a piece of source code - never leaves your device. Optional settings let you wrap the result in double quotes to produce a complete JSON string literal, escape all non-ASCII characters as \uXXXX for maximum portability, or escape the forward slash for safe embedding inside a <script> tag.
Escaping is about producing a string that survives being embedded in JSON, which is a narrower job than it sounds. Control characters below U+0020 must be escaped and cannot appear literally, which is why a string containing a real newline is invalid until converted to a backslash n. Forward slashes may be escaped and do not have to be, a legacy of embedding JSON in HTML script tags where the sequence closing a script element would otherwise terminate it early. Unicode above the basic plane is stored as surrogate pairs, so a single emoji becomes two escape sequences and a string split in the middle of that pair is corrupt.
Paste the raw text you want to embed in JSON, or the already-escaped JSON string you want to decode, into the input panel. Click Load Sample to see a multi-line example.
Pick Escape to convert raw text into a JSON-safe string, or Unescape to turn a JSON-escaped string back into its original characters.
When escaping, optionally wrap the output in double quotes, escape all non-ASCII characters as \uXXXX, or escape the forward slash. Unescaping needs no options.
Copy the escaped or unescaped output to your clipboard and drop it straight into your JSON file, API request, or code.
Convert raw text into a JSON-safe string and back again, both from the same tool with a single toggle
Newlines, tabs, carriage returns, backspace, and form feed become \n, \t, \r, \b, and \f, while other control characters are escaped as \uXXXX
Wrap the escaped output in double quotes to produce a complete, ready-to-paste JSON string literal
Optionally escape every non-ASCII character as \uXXXX so the output is pure ASCII and safe to transmit through any channel
Convert JSON to clean, valid YAML instantly - configurable indentation and safe string quoting
Convert YAML to JSON instantly - anchors, aliases, merge keys, block scalars and multi-document streams supported
Detect and remove invisible Unicode characters from AI text - zero-width joiners, variation selectors, bidi controls, and tag characters.
Encode and decode HTML entities - named (&), decimal (&), and hex (&) forms, with XSS-safe special-character escaping
0 comments
No comments yet. Be the first to share your thoughts!