Code Beautifier

JSON Stringify & Unstringify

Escape text into a JSON string, unescape it back, stringify a document for embedding, or decode double-encoded JSON.

Draft saved locally.

Local workspace

Named projects in IndexedDB · Local only — never synced to our servers. Worksp

Open manager

Batch workspace

Format multiple files locally in one run.

Mode:
text
Formatted Outputtext

Options

OptionDescription
ModeEscape and Unescape work on any text. Stringify turns a JSON document into a single string value. Parse unwraps JSON that was stored as a string.
Wrap in quotesAdds the surrounding double quotes, so the output is a complete JSON string literal.
Escape non-ASCII as \uXXXXWrites characters outside ASCII, such as é or emoji, as \u escapes for systems that aren't UTF-8 safe.
IndentFormatting of the decoded JSON.

FAQ

Which characters does JSON escaping change?

Double quotes, backslashes, and control characters such as line breaks and tabs become \", \\, \n, and \t. U+2028 and U+2029 are escaped too, because they end string literals in older JavaScript engines.

What is double-encoded JSON?

It's JSON saved as a string inside other JSON, so it looks like "{\"id\":7}". Logs, message queues, and some databases produce it. Parse mode unwraps it, even when it was encoded more than once.

When should I use Stringify instead of Escape?

Use Stringify to embed a whole JSON document as a string value, for example in an environment variable or another JSON payload. It minifies the document first. Escape works on any text.

Why does Unescape report an invalid escape sequence?

JSON allows only \" \\ \/ \b \f \n \r \t and \uXXXX. Escapes from other languages, such as \x41 or \', aren't valid JSON; write them as \u0041 or a plain apostrophe.

Should I escape non-ASCII characters?

Only when the JSON passes through a system that isn't UTF-8 safe. 'Escape non-ASCII' writes characters like é as \u00e9, which parses back to the same text.