When you manually construct JSON strings, special characters like quotes and newlines can break the structure. This guide explains how to escape plain text into JSON-safe form and how to reverse escaped JSON back into the original text, using the ToolOrbit JSON Escape/Unescape tool.
What needs escaping in JSON
- Double quotes must become \" inside a JSON string.
- Backslashes become \\.
- Newlines become \n, tabs become \t.
- Non-printable characters are encoded as \uXXXX.
Hello "world" Line two -> "Hello "world" Line two"
When to escape text
- Embedding user input in a JSON payload.
- Creating JSON strings inside JavaScript code.
- Preparing API requests with dynamic fields.
- Debugging JSON stored in config files or logs.
Using the tool
Paste raw text and choose Escape to get a JSON-safe string, or paste escaped JSON and choose Unescape to recover the original text. This is useful for fixing broken JSON fragments or preparing test data for APIs.