JSON Stringify Text

Wrap raw text as a properly escaped JSON string literal

Raw text

JSON string literal

Nothing you type here is ever sent anywhere — conversion happens entirely in your browser.

About this tool

JSON strings can't contain raw newlines, unescaped double quotes, or literal backslashes — each of those has to be escaped before the text is valid inside a JSON document. This tool runs your text through JavaScript's own JSON.stringify, wrapping it in double quotes and escaping every character that needs it (quotes become \", backslashes become \\, newlines become \n, and so on), so you get a value you can paste directly into JSON, an API payload, or source code as a string literal.

Why do I need to escape text before putting it in JSON?

The JSON spec reserves certain characters — double quotes, backslashes, and control characters like newlines and tabs — because they'd otherwise be ambiguous inside a quoted string. Escaping replaces them with a backslash sequence so a JSON parser can read the string back exactly as intended.

What does the output actually look like?

A complete JSON string value, including the surrounding double quotes — for example, the text he said "hi" becomes "he said \"hi\"", ready to drop into a larger JSON object as a value.

Does this handle Unicode characters and emoji?

Yes — non-ASCII characters like accented letters and emoji are preserved as-is in the output, since valid JSON strings can contain UTF-8 text directly without needing to be escaped as \u sequences.