What is JSON Escape / Unescape?
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.
Here is a worked example of escape / unescape JSON on a multi-line SQL query. Paste the three lines SELECT *, FROM "users" and WHERE id = 1, tick Wrap in quotes and click Escape. The output is "SELECT *\nFROM \"users\"\nWHERE id = 1", one line with each newline turned into \n and each quote into \", ready to paste as a JSON value. Switch to Unescape, paste that result back, and the three original lines return with the outer quotes stripped. That round trip is the whole job of an escape unescape JSON tool.
How to use JSON Escape / Unescape?
Paste your text
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.
Choose escape or unescape
Pick Escape to convert raw text into a JSON-safe string, or Unescape to turn a JSON-escaped string back into its original characters.
Set your options
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 result
Copy the escaped or unescaped output to your clipboard and drop it straight into your JSON file, API request, or code.
Key Features
Escape and Unescape
Convert raw text into a JSON-safe string and back again, both from the same tool with a single toggle
Full Control-Character Support
Newlines, tabs, carriage returns, backspace, and form feed become \n, \t, \r, \b, and \f, while other control characters are escaped as \uXXXX
Optional Quote Wrapping
Wrap the escaped output in double quotes to produce a complete, ready-to-paste JSON string literal
Unicode Escaping
Optionally escape every non-ASCII character as \uXXXX so the output is pure ASCII and safe to transmit through any channel
Frequently Asked Questions
Related Tools
JSON to SQL Converter
Convert a JSON array of objects into SQL CREATE TABLE and INSERT statements for MySQL, PostgreSQL, or SQLite. Infers types, runs client-side.
JSON to YAML Converter
Convert JSON to clean, valid YAML instantly - configurable indentation and safe string quoting
JSON Validator
Validate JSON against RFC 8259 and get the exact line, column, and character of the first syntax error, plus duplicate-key detection and structure stats. Client-side, no signup.
YAML to JSON Converter
Convert YAML to JSON instantly - anchors, aliases, merge keys, block scalars and multi-document streams supported
Comments
0 comments
No comments yet. Be the first to share your thoughts!