Paste an escaped JSON string and get readable, formatted JSON back, even when it was escaped twice. Or escape JSON to put it inside a string.
Paste the escaped JSON in the left field. Readable JSON appears on the right as soon as it is pasted, indented with two spaces. Copy it, and you are done.
It takes the string the way you found it:
payload= labelNumbers come out exactly as they went in, so a long id like 1234567890123456789 keeps its last digits. If the result is not valid JSON, the line under it says what is wrong and where.
A few characters cannot stand as themselves inside a JSON string, so they are written with a backslash:
\" is a double quote, \\ a backslash\n and \r are line breaks, \t a tab\/ is a slash\u00e6 is a character by its number, here æ, and \ud83d\ude00 is an emoji written in two halvesWhen a whole JSON document is saved as a string, every quote in it becomes \". Save that string as a string again, and the backslashes get escaped too: \\\". That is why some logs are more backslash than data.
Unescaping takes off one layer at a time. This tool keeps going until it reaches JSON or plain text and tells you how many layers there were.
Escape JSON goes the other way: your JSON becomes the inside of a string, ready for a JSON field, a config value, an environment variable or a string in code. It gives the same result as JSON.stringify() on the text.
The JSON is put on one line first, so a formatted document does not turn into a string full of \n. Tick Keep line breaks to escape it exactly as it stands, and Leave out the outer quotes when you paste between quotes you already have.
In code, a JSON string is unescaped by parsing it: JSON.parse(s) in JavaScript, json.loads(s) in Python, json_decode($s) in PHP. If what comes back is still a string, it was escaped twice, so parse it once more.
It turns a JSON string back into the JSON it holds: \" becomes a quote, \\ a backslash and \n a line break. You need it when JSON was stored or logged as text, so it shows up as one long line full of backslashes instead of something you can read.
Because it was escaped more than once. Each time JSON is saved as a string, every quote gets a backslash, and the next time those backslashes get one too, so \" turns into \\\". This tool takes off every layer in one go and says how many there were.
Paste it here and the object comes out formatted. In code, parse it: JSON.parse(s) in JavaScript, json.loads(s) in Python, json_decode($s, true) in PHP. If the result is still a string rather than an object, it was escaped twice, so parse it once more.
That is common in SQS and SNS messages, API Gateway events and webhooks: the outer JSON is fine, but one value, often called body or Message, is JSON saved as text. Paste the whole thing, and the line under the result says how many values hold JSON. Click Unescape those too, and they become JSON in place, also when one sits inside another. They stay text until you click, because it turns that value from a string into an object.
The message says what is wrong and gives the line and column. The usual causes are a comma after the last item, single quotes instead of double, keys without quotes, True, False or None from Python instead of true, false and null, and a log line that was cut off before the JSON ended.
No. Numbers are copied exactly as written, so a long id is not rounded the way JSON.parse rounds it in a browser, and the keys stay in their order, duplicates included. Only the spacing changes, and escapes such as \u00e6 are shown as the character they stand for (æ). Characters that have to stay escaped, like a line break inside a string, stay escaped.
None, here. Escape JSON gives exactly what JSON.stringify() returns for your JSON as text: the JSON wrapped in quotes with its own quotes and backslashes escaped. Tick Leave out the outer quotes to drop the outer pair. For other kinds of strings, such as SQL, CSV or a JavaScript string in single quotes, use Escape Text.
No. It is unescaped and escaped in your browser, so logs and API responses with private data stay on your computer.