JSON escape
Type or paste any text, such as a JSON document, a template or a message over several lines, and see it as a JSON string below: in double quotes, with quotes, backslashes, line breaks and tabs escaped.
What is escaped
- Double quotes become \"
- Backslashes become \\
- Line breaks and tabs become \n and \t
- Other control characters become Unicode escapes
Letters such as é, and emoji, are kept as they are, which JSON allows.
JSON inside JSON
Some APIs and message queues expect a JSON document as a string inside another one. Minify the JSON first so the string stays short and on one line.
In code and commands
The result is valid JSON, and a valid string in JavaScript and many other languages, so it can go into source code, a test fixture, a curl command or an environment variable.
And back
Paste a JSON string anywhere in the Formatter, such as on the JSON unescape page, to see the text inside again.
Private: nothing is uploaded
Formatting, checking and comparing all happen in your browser. Your documents are saved in the browser's own storage on this computer, not on a server, so they never leave your device.
With your permission, we count anonymous visits (which pages and tools are used), never what you type. See Privacy.
Questions
How do I escape JSON for a string?
Paste the JSON: the escaped string appears below, ready to copy. Minify the JSON first for a one-line string.
Is my data uploaded anywhere?
Your documents aren't: everything runs in your browser, and they are saved on your computer, in the browser's storage for this site. With your permission we count anonymous visits, never their content.
More tools
- Formatter & Converter for JSON, YAML, XML, SQL
- JSON Formatter, Validator & Minifier
- JSON Diff – Compare Two JSON Files Online
- JSON5 & JSON with Comments Formatter
- JSON Unescape – Read Stringified JSON
- JSON to YAML Converter
- YAML to JSON Converter
- JSON to TOML Converter
- TOML to JSON Converter
- Online Diagram & Flowchart Editor
- UUID, Password, Hash & Secret Key Generators