Nothing escaped yet
Paste any text to get a valid JSON string literal you can drop straight into a document.
Runs entirely in your browser. Your data isn't uploaded — this page makes no network request with anything you type, which you can verify in your browser's network tab. How this works.
What is the JSON Escape?
Sometimes a JSON document has to travel inside another JSON document — a payload stored in a string field, a request body embedded in a test fixture, a template variable. To do that safely the text has to be escaped into a valid JSON string literal.
This tool does exactly that: quotes, backslashes, newlines, tabs and control characters become their escape sequences, and you get back a single string you can paste anywhere a JSON string is expected.
How to use it
- Paste the text or JSON you want to embed.
- Choose whether to include the surrounding double quotes.
- Press Escape (or Ctrl/Cmd + Enter).
- Copy the escaped string.
Example
A JSON document escaped so it can live inside a JSON string field.
{"ok": true}
"{\"ok\": true}"
Features
- Escapes ", \\, newlines, carriage returns, tabs and control characters
- Optional surrounding quotes so the result drops straight into a document
- Optional \\uXXXX escaping of all non-ASCII characters for ASCII-only transports
- Optional forward-slash escaping for values embedded in HTML script tags