JSON Stringify Text

Paste text and get a valid JSON string literal back instantly.

Options

The result updates as you type. Ctrl + Enter stringifies now.

JSON string output

How to stringify text to JSON

Paste your text into Your text, or press Load example. A valid JSON string literal, wrapped in quotes with special characters escaped, appears next to it and updates as you type. Copy the result or download it as a .json file. Everything runs in your browser, so nothing you paste is uploaded.

Examples

InputOutput
hi "hi"
say "hi" "say \"hi\""
Say "hi" to C:\temp! Café 😀 "Say \"hi\" to C:\\temp!\nCafé 😀"

Limits and edge cases

  • What gets escaped: double quotes become \", backslashes become \\, newlines become \n, tabs become \t, and other control characters become \uXXXX sequences.
  • ASCII-only mode escapes every non-ASCII character as \uXXXX, with emoji written as surrogate pairs (for example, 😀 becomes \ud83d\ude00). Use it when the receiving system only accepts pure ASCII.
  • Lone surrogates are escaped as \uXXXX just like JSON.stringify does, so the output always parses back to the exact input.
  • This tool stringifies one piece of text into a single JSON string value. To pretty-print or validate a whole JSON document, use a JSON formatter tool instead.

Frequently asked questions

How do I convert text to a JSON string?

Paste your text into the input box and the tool outputs a valid JSON string literal, wrapped in quotes with special characters escaped. Copy it or download it as a .json file.

What characters get escaped?

Double quotes, backslashes, and control characters like newlines and tabs are escaped. Other control characters become \uXXXX sequences. Unicode letters and emoji stay readable by default.

What does the ASCII-only option do?

ASCII-only escapes every non-ASCII character as \uXXXX, with emoji written as surrogate pairs. Use it when the receiving system only accepts pure ASCII JSON.

Can I paste the output directly into code?

Yes. The output is a complete JSON string literal including the surrounding quotes, so you can paste it into JSON documents, JavaScript, or any language that reads JSON strings.

How do I get my original text back?

Run the output through a JSON parser. In JavaScript, JSON.parse of the output returns exactly the text you pasted in.

Is my text uploaded anywhere?

No. Stringifying runs in your browser with JavaScript and nothing is sent to a server. Inputs under 200 KB are kept in your browser's local storage so they are still there when you come back.