JSON Escape turns ordinary text into a JSON string: surrounding quotes, escaped quotes, escaped backslashes, and \n for line breaks. Unescape does the reverse: it reads a JSON string (or a fragment of one) and returns the real characters. This is not a JSON formatter and not a JSON validator. Those pages parse a whole JSON value. This page is for the string encoding layer.
Developers hit this when a log field is "{\"ok\":true}", when a path like C:\temp\file.json must go inside JSON, or when a copy-paste still contains \" and \\n. Escape is for putting text into JSON. Unescape is for taking a JSON string back to readable text. If you paste a JSON object or array and choose Unescape, the tool refuses: that value is already structured JSON. Open the JSON Formatter instead.
Escape always treats the entire box as raw text. It does not parse the input as JSON first. A trailing comma in the box is just characters. After Escape you get a single JSON string that would be legal as a value inside a larger document.
"hello\\nworld" (to Unescape).Unescape first tries JSON.parse on the trimmed input. If the result is a string, that string is the output. If the result is an object or array, you get an error pointing you at the formatter. If parse fails, Unescape tries wrapping the text in quotes and parsing that — useful for a fragment like Hello \"Ada\" that is missing the outer quotes. Raw line breaks that are not encoded as \n still fail, because JSON strings cannot contain unescaped newlines.
Raw text before Escape:
He said "hello"
Path: C:\temp\file.json
Escape writes one JSON string (quotes included). Unescape on that output returns the original two lines. A second common case is a twice-encoded API field:
"{\"ok\":true,\"n\":2}"
Unescape once. The output is {"ok":true,"n":2} as text. That inner text is now JSON you can paste into the JSON Validator or the viewer. Unescape does not pretty-print it. Decode one layer at a time. The pretty-print-from-logs guide describes when a log line needs this extra step.
Validate asks whether a string is JSON at all. Format asks for whitespace after a successful parse. JSON escape asks how a string is encoded inside JSON. Mixing those jobs on one control hides the intent. Use this page when the quotes and backslashes are the problem. Use validate when you do not know if the whole payload is legal. Use format when it is legal and you cannot read nesting.
Invalid JSON escapes such as \x41 fail Unescape the same way JSON.parse fails. That is expected. JSON allows a small escape set. The parse-error solution on this site lists that class of mistake. Do not expect Unescape to “fix” a trailing comma in an object.
json_encoded twice in PHP\n sequences into real line breaks so you can read a messageIf you are converting a whole table of records, that is JSON to CSV, not escape. If you only need to see nested keys, use the JSON Viewer after the string is real JSON.
Escape and unescape run in this browser with JSON.stringify and JSON.parse. Nothing is posted to YallaSolve for this tool. Clear the tab if you pasted secrets.
Escape turns any text into a JSON string (quotes and backslashes included). Unescape reads a JSON string and returns the real characters. This page does not pretty-print objects.
No. The whole box is treated as raw text. JSON.stringify wraps it as one JSON string, including quotes.
Unescape is for JSON strings. If parse returns an object or array, use JSON Formatter or JSON Viewer.
Yes. Unescape one layer at a time. When the output is real JSON, validate or view it. Do not expect Unescape to indent an object.
Yes. Escape on an empty box produces a JSON empty string: two quotes. Unescape still needs a JSON string to read.