JSON Escape
Escape text so it can be embedded safely inside a JSON string.
Processing: This tool runs entirely in your browser. Your input and any file you open stay on your device — nothing is uploaded to a server.
How to use the json escape
- Paste your text.
- Copy the escaped result.
- Paste it between quotes in your JSON.
About this tool
A JSON string cannot contain a raw quote, a raw backslash, or a literal newline. Embedding text that has any of them without escaping produces a document that will not parse — and the error usually points at a line some distance from the actual problem, which is what makes it annoying to find.
This escapes exactly what the JSON specification requires: quotes, backslashes, newlines, carriage returns, tabs and control characters. Nothing else is touched, so accented letters and emoji pass through as themselves rather than being turned into <code>\u</code> sequences that make the result unreadable.
The output is the body of a string, without the surrounding quotes, since it is normally being pasted between quotes that already exist.
Everything happens in the page. JSON commonly carries API keys, personal records and internal identifiers, so nothing here is uploaded, logged or sent to a server — which is exactly why a browser tool is the right place to inspect it.
Common uses
- Embedding a code snippet or SQL query in a JSON config.
- Putting multi-line text into a single JSON string.
- Fixing JSON that will not parse because of an unescaped quote.
Frequently asked questions
- Are the surrounding quotes included?
- No — just the escaped body, since you are normally pasting it between quotes that are already there.
- Are emoji and accents escaped?
- No. They are valid in JSON as they are, and escaping them to \u sequences would only make the result harder to read.
- Which characters get escaped?
- Exactly what the specification requires: quotes, backslashes, newlines, carriage returns, tabs and control characters.
Related tools
JSON Unescape
Turn an escaped JSON string back into readable text, with or without its quotes.
JSON Formatter
Format, validate and minify JSON with clear error messages that point at the exact position.
HTML Entity Encoder & Decoder
Escape text for safe use in HTML, or decode entities back into readable characters.
URL Encoder & Decoder
Percent-encode text for safe use in URLs, or decode an encoded URL back to readable text.