Escape Text for a JSON String Value
Convert plain text into a JSON string literal or decode a quoted JSON string back into plain text.
Choose the right syntax
JSON string escaping protects double quotes, backslashes and control characters inside a JSON value. It is different from HTML or URL encoding. Choose the encoding for the place where the value will be used, rather than repeatedly applying unrelated encoders.
Keep the surrounding quotes
The escaped result is a complete string literal with double quotes. Unescape expects that complete representation. Pasting bare text or a JSON object produces an error because those inputs are not the string value this tool is designed to decode.
Distinguish a newline from its escape
A literal newline and the two characters backslash followed by n are different inputs. Escaping preserves that distinction. Copy the entire result when moving it into JSON, and avoid having another editor add an extra escaping layer.
Serialize complete documents properly
When building an API payload in code, use the language’s JSON serializer for the whole object. Manually joining quoted fragments can introduce mistakes. This tool is useful for inspecting a string value, not replacing structured serialization throughout an application.
Put it into practice
JSON Formatter & Validator
Validate JSON, indent it for reading or remove extra whitespace while preserving original number tokens.
Developer toolsURL Component Encoder & Decoder
Encode text for a URL component or decode percent escapes, with an explicit form-style plus option.
Developer toolsHTML Entity Encoder & Decoder
Encode special HTML characters or decode named and numeric character references as plain text.
Developer toolsJSON String Escape & Unescape
Convert plain text into a JSON string literal or decode a quoted JSON string back into plain text.
Developer tools