Skip to content

JSON Escape

Escape text so it can be safely embedded in a JSON string value.

0 chars | 1 lines
0 chars | 0 lines

All conversions happen in your browser. No data is sent to our servers - see why that matters. Share links encode your input in the URL itself; nothing is stored on a server.

How to Escape Text for JSON

Paste any text into the input panel. The tool applies the exact escaping rules from the JSON specification and outputs a string you can safely place inside double quotes in a JSON document.

Why JSON Escaping Matters

JSON strings cannot contain raw double quotes, backslashes, or control characters like newlines. A single unescaped quote breaks the entire document, which is one of the most common causes of 'invalid JSON' errors in APIs and config files.

Common Use Cases

Escape text when embedding multi-line messages in JSON payloads, storing code or regex patterns in config files, writing test fixtures by hand, or preparing strings for curl requests.

Frequently Asked Questions

What characters get escaped?

Double quotes become \", backslashes become \\, newlines become \n, tabs become \t, carriage returns become \r, and control characters become \uXXXX sequences - exactly per the JSON specification.

Does the output include surrounding quotes?

No. The output is just the escaped content, ready to paste between the quotes of a JSON string value.

When do I need to escape text for JSON?

Whenever you build JSON by hand or via string templates - embedding log messages, code snippets, SQL, or user input inside a JSON string without escaping produces invalid JSON.

Is my text uploaded anywhere?

No. Escaping runs entirely in your browser using JavaScript's native JSON.stringify.

Related Tools