Developer tools TOOL

JSON string encoding

Convert between text and JSON strings.

01

Enter your text

On-device processing
Input · Up to 2 MB
02

Output options

No account. No uploads.

JSON string encoding · How to use

Convert between text and JSON strings.

Example

Hello "Poptools" → "Hello \"Poptools\""

Things to know

Handles JSON string quotes and escapes. Use JSON formatting and validation for object indentation.

Output options

Operation
Encode · Decode

Your files and results are never sent to a server. Everything is processed in this browser.

How to escape text as a JSON string and unescape it

Putting a SQL query or multi-line message into a JSON request body means escaping its quotes and line breaks. Decode when a log shows a string with literal \n sequences and you want to read it as separate lines.

When to use this tool

  • Insert multi-line SQL or messages into a JSON request
  • Read escaped strings copied from logs
  • Prepare a JSON string for an environment variable

Step-by-step instructions

  1. Paste the text to convert, or choose Use sample.
  2. Under Operation, choose Encode or Decode.
  3. Choose Convert.
  4. Copy the result into your JSON or code.

Frequently asked questions

Do I include the surrounding double quotes when decoding?

Yes. Input must be a complete JSON string wrapped in double quotes, such as "Hello\nWorld". Content without quotes, or an object or array, produces an error.

Does encoding turn non-ASCII characters into \u escapes?

No. Only double quotes, backslashes and control characters such as line breaks are escaped; accented letters and emoji stay as they are. Use the Unicode escape tool if you need \uXXXX sequences.

Can it format an entire JSON object?

This tool handles quotes and escapes for a single string value. To indent an object or array and check its syntax, use the JSON formatter and validator.

Save only the tools you need.