What Is JSON Escaping?
JSON escaping converts special characters (double quotes, backslashes, newlines, tabs, carriage returns) into their escape sequences. This makes JSON safe to embed in JavaScript source code, SQL queries, URL parameters, and other string contexts.
Escaping is essential for:
- Source Code: Embedding JSON literals in JavaScript or Python code.
- SQL Queries: Safely including JSON in database queries.
- URL Parameters: Encoding JSON for query string parameters.
- Log Output: Ensuring JSON strings don't break log parsers.
How to Escape JSON Online
- Paste your JSON: Enter valid JSON data.
- Click Escape: Special characters are converted to escape sequences.
- Copy the result: Use in source code or queries.
Frequently Asked Questions
What characters are escaped?
The tool escapes double quotes ("), backslashes (\)), newlines (\n), carriage returns (\r), and tabs (\t).
Can I unescape escaped JSON?
Yes. Use bidirectional mode or the JSON Unescape tool.
Is this tool safe?
Yes. Processing is 100% client-side.
Related Tools
- JSON Unescape — Reverse operation
- JSON to URL Encoded — URL-encode JSON data