JSON Stringify Text
Escape raw text into a valid, quoted JSON string literal.
Converters Runs in your browser
How do you stringify text into JSON?
Feed it two paragraphs and a tab, and out comes one quoted literal with \n and \t where the whitespace was. The escaping matches JSON.stringify exactly: double quotes become \", backslashes double up, and control characters turn into \uXXXX sequences. Surrounding quotes are included, so the result drops into a JSON document or a source file as-is.
How to use the JSON Stringify
- 1 Put the raw text in, line breaks and all.
- 2 One escaped, quoted literal comes out.
- 3 Double-check the surrounding quotes are part of the output; they belong there.
- 4 Insert the literal into your JSON or source file.
What you can use it for
- Embedding multi-line text as a JSON string value.
- Escaping a snippet to paste into a config file.
- Preparing a string for a JSON API payload.
- Safely quoting text that contains quotes or newlines.
Frequently asked questions
Which characters get escaped?
Double quotes, backslashes, and every control character: newline to \n, tab to \t, carriage return to \r, the rest to \uXXXX. Identical behaviour to JSON.stringify on a string.
Are the outer quotes part of the result?
Yes. What you copy is a complete JSON string literal, valid on its own as a JSON document value.
What undoes this?
The JSON Unstringify tool reverses the process, returning the original raw text.
Related tools
More Converters
More tools like this:
All Converters