JSON Escape
Client-sideEscape text into a JSON string literal, or unescape a JSON string back to raw text — instantly and offline.
JSON Escape converts raw text into a JSON string literal (or unescapes one) in your browser — it does not reformat whole documents.
Examples
Key takeaways
- Escape raw text to a quoted JSON string
- Unescape literals back to plain text
- Client-side only
- Not a full-document formatter
What is JSON string escaping?
Escaping turns characters like quotes and newlines into JSON string escape sequences so the value is safe inside a JSON document.
Use Escape for string values you will embed in JSON. Use JSON Formatter when you need to pretty-print an entire object or array.
Features
Escape to JSON string
Produce a quoted JSON string ready to embed in code or payloads.
Unescape literals
Decode escaped sequences back into plain text.
Flexible input
Unescape accepts values with or without surrounding quotes.
Copy & download
Move results into editors, configs, or tickets in one click.
How it works
Paste raw text or an escaped string
Use raw text for Escape, or a JSON string literal for Unescape.
Choose Escape or Unescape
Escape produces a quoted JSON string. Unescape returns the decoded text.
Copy the result
Copy or download the output for use in code or configs.
Example walkthroughs
Multiline text
Newlines, tabs, and quotes become escaped sequences inside a JSON string literal.
Hello World "quoted"
Escaped literal
Unescape restores the original multiline plain text.
"Hello\nWorld\t\"quoted\""
Use cases
Embed strings in JSON configs
Safely encode messages, paths, or templates for JSON documents.
Decode log fragments
Turn escaped log lines back into readable text.
Prepare test fixtures
Generate correctly escaped string values for unit tests.
Code snippets
Escape with JSON.stringify
jsEscape mode matches wrapping text as a JSON string literal.
const literal = JSON.stringify("Hello\nWorld"); // → ""Hello\nWorld""
Common errors
Unescape fails on raw text
Cause: Unescape expects an escaped JSON string (often with quotes).
Fix: Use Escape for raw text, or paste a quoted literal for Unescape.
Whole document became a string
Cause: You escaped an entire JSON object as if it were plain text.
Fix: Use JSON Formatter for documents; use Escape only for string values.
About JSON Escape
JSON Escape converts raw text into a valid JSON string literal — escaping quotes, newlines, tabs, and other characters so the value is safe inside a JSON document. Use it when you are building payloads by hand, embedding messages in configs, or cleaning strings copied from logs.
Unescape reverses the process so you can recover readable text from an escaped literal (often including surrounding quotes). This is not a full-document formatter: escaping an entire object as if it were plain text will turn the document into one big string, which is rarely what you want.
Escaping and unescaping run in your browser. Draft copy, error messages, and SQL fragments with quotes never need to leave the device. Pair with URL Encode when the next hop is a query parameter, or with Base64 Encode Text when the channel wants opaque ASCII instead of JSON escapes.
Best practice: format or validate complete JSON documents with the dedicated JSON tools; reserve Escape for string values. After unescaping, skim for leftover backslashes that indicate a double-escaped source. Prefer explicit newlines in the editor before escaping rather than pasting broken multi-line literals.
Frequently asked questions
What does Escape produce?
A valid JSON string literal, including surrounding quotes, with characters like newlines and quotes escaped.
Can I unescape without surrounding quotes?
Yes. If quotes are missing, the tool wraps the value before parsing as a JSON string.
Is this the same as encoding a whole JSON document?
This tool targets string escaping. To format whole documents, use JSON Formatter.
Related tools
JSON Formatter
Format, beautify, and minify JSON in your browser. Free, private, and instant — no upload to a server.
JSON Validator
Validate JSON instantly in your browser. See type, size, and node counts — or exact parse errors with line and column.
JSON Viewer
Explore JSON as an interactive tree with paths, types, and expandable nodes — all processed locally in your browser.
JSON Compare
Compare two JSON documents structurally. Find added, removed, changed, and type-changed paths — privately in your browser.
JSON Diff
Generate a unified diff of two JSON documents after pretty-printing. Ideal for reading line-level changes quickly.
URL Encode / Decode
Percent-encode text for URLs or decode encoded query strings — private and instant.
Popular tools
Base64 Encode / Decode
Encode UTF-8 text to Base64 or decode Base64 back to text — instantly in your browser.
JWT Decode
Decode JWT header and payload in your browser — inspect claims without uploading tokens.
UUID Generator
Generate UUID v4 identifiers in bulk — uppercase and hyphenless options, fully client-side.
Regex Tester
Test JavaScript regular expressions against sample text — matches and groups, private in your browser.
Newest tools
Gradient Generator
Build linear and radial CSS gradients with Tailwind output — private and client-side.
Case Converter
Convert text between UPPERCASE, lowercase, Title Case, camelCase, snake_case, and more.
Word Counter
Count words, characters, sentences, and paragraphs with reading time — live and private.
Text Diff
Compare two texts line by line — see added and removed lines with a unified-style diff.
Explore more
Guides & articles
Escape JSON Online — Escape, Unescape & Stringify Safely
Escape JSON online or unescape a JSON string in your browser. Convert JSON to an escaped string, parse escaped string to JSON — private, free, no upload.
JSON string escaping tips on the RS Roshi blog
Guides and deep-dives related to json string escaping.
Platform docs & shortcuts
Keyboard shortcuts, privacy model, and how tools run client-side.