JSON Escape / Unescape
Escape text for safe embedding inside JSON strings, or decode escaped JSON strings back to readable text.
Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.
About this tool
Embedding text inside a JSON string means escaping quotes, backslashes, newlines and control characters — get one wrong and the whole document fails to parse. This tool escapes and unescapes JSON strings exactly the way JSON.stringify and JSON.parse do.
Paste raw text to escape it, or paste an escaped string to see the original.
How to use it
- Choose Escape or Unescape.
- Paste your text — results appear instantly.
- Tick Wrap result in quotes if you need a complete JSON string literal.
- Copy the result.
Useful ways to apply it
- Putting multi-line text or code snippets into a JSON config value.
- Decoding \n and \" sequences from API logs into readable text.
- Preparing strings for hand-written JSON payloads in tests.
- Fixing double-escaped strings from chained systems.
Worked example
Example input
He said: "Paths use \ on Windows" + newline/tab characters
Expected output
He said: \"Paths use \\ on Windows\"\nSecond line\tTabbed
Edge cases to check
- Escaping a JavaScript string and escaping JSON text are related but not interchangeable in every embedding context.
- Unescaping invalid backslash sequences is rejected.
- Unicode characters may remain literal rather than being converted to \u escapes.
Known limitations
This utility targets JSON string escaping/unescaping. It is not a general sanitizer for HTML, JavaScript source, SQL or shell commands.
How this tool was reviewed
Reviewed with quotes, backslashes, newline/tab controls, Unicode and malformed escape sequences.
Standards and technical references
See the site-wide testing methodology for fixture categories, privacy checks and correction policy.
Frequently asked questions
Which characters get escaped?
Why does my unescape fail?
Does it handle Unicode?
Privacy
Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.