About the JSON Stringify Online
This is JSON.stringify(text) as a web page: paste text, get a double-quoted JSON string with every special character escaped. Unlike the JSON Escape tool it includes the surrounding quotes, so the output is a complete JSON value you can drop into a document, a request body or a test.
It is most useful for multi-line content: a SQL query, a template, a certificate or a block of Markdown that needs to travel inside a JSON field. Line breaks become \n, tabs become \t, and quotes and backslashes are escaped. Characters outside ASCII are kept as they are, since JSON is UTF-8.
To reverse the conversion, paste the literal into the JSON Unescape tool or into the formatter, which will show the original text as a string value.
How to use
- Paste the text on the left.
- Copy the single-line quoted string from the right.
- Paste it as a value in your JSON or as a string literal in code.
Common questions
- How is this different from JSON Escape?
- JSON Escape returns the escaped contents without quotes, for pasting inside an existing string. Stringify returns a complete quoted string literal.
- Can I stringify an object?
- Paste JSON text into the left pane and the output is that JSON encoded as a single string, which is what you need for double-encoded fields.
- Does it fold long lines?
- No. The output is always one line, however long.