What is JSON escaping?
JSON escaping converts characters that would break a JSON string into backslash sequences. Without it, a quote inside the text ends the string early and a line break makes the whole document invalid.
Developers need it when building request bodies by hand, storing a snippet of HTML or a message template in a config file, embedding one JSON document as a string inside another, or putting text into environment variables. Unescaping is the reverse: logs, API responses and databases often show strings full of \n and \", and unescaping turns them back into the original text.
How to use the JSON Escape
1.Choose escape or unescape
Escape to embed text in JSON; unescape to read a JSON string.
2.Paste the text
Multi-line text, Windows paths and quotes are all handled.
3.Copy the result
Optionally wrapped in double quotes, ready to drop into a JSON file.
Example: a message with quotes, a line break and a path
The text She said "hi", a line break, then "then left.", a tab and C:\Users\me:
- Quotes
- \"hi\"
- Line break
- \n
- Tab
- \t
- Path
- C:\\Users\\me
The escaped text can sit between double quotes in any JSON file and parses back to the original.
What gets escaped
JSON strings can't contain raw double quotes, backslashes or control characters. Escaping turns " into \", \ into \\, a line break into \n and a tab into \t, using the browser's own JSON encoder, so the output is always valid.
Escape non-ASCII adds \u codes for characters like é and emoji, for systems that only accept ASCII. Unescaping reads the text as a JSON string and reports the position of anything that isn't valid, such as \q or a lone backslash.
Frequently asked questions
Why do I see \\ in my JSON?
A single backslash in text is written as two in JSON. Windows paths like C:\Users become C:\\Users.
Do I need to escape single quotes?
No. Only double quotes delimit JSON strings, so ' stays as it is.
Can it unescape a value with the quotes included?
Yes. Paste it with or without the surrounding double quotes.
How do I escape a whole JSON object as a string?
Paste the object and choose escape. The result can be stored as a string inside another JSON document.
Related tools
JSON Formatter & Validator
Pretty-print, minify, sort and validate JSON with line-numbered errors.
Flatten & Unflatten JSON
Flatten nested JSON to dotted keys, or unflatten it back.
HTML Entity Encoder & Decoder
Escape text to HTML entities, or decode entities back to text.
JSON ↔ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON.
JSON to TypeScript Interface Generator
Generate TypeScript interfaces or types from a JSON sample.
JSON ↔ YAML Converter
Convert JSON to YAML and YAML to JSON.
More Developer tools
JSON & data
CSV tools
Network & system
Web & API
Git & releases
Encoding & security
- Base64 encode & decode
- URL encode & decode
- JWT decoder
- Hash generator
- Text to binary
- Morse code translator
- Caesar cipher & ROT13
- Random string generator
- Secret key generator
- 2FA code generator (TOTP)
- Encrypt & decrypt text
- Encrypt & decrypt files
- SSH key generator
- Base32 encoder and decoder
- Unicode escape converter
- Nano ID generator
- JWT generator
Text & code
- Regex tester
- Text diff checker
- Cron expression explainer
- Lorem ipsum generator
- Markdown previewer
- Slug generator
- Strip HTML tags
- Unicode character inspector
- URL parser
- Markdown TOC generator
- cURL converter
- Whitespace visualizer
- Markdown link extractor
- Regex escape
- Regex match extractor
- Split text by regex
- HTML, CSS and JS playground
- Mock data generator
- Keyboard event tester
- ASCII table