Developer tools TOOL
JSON string encoding
Convert between text and JSON strings.
Enter your text
On-device processingJSON 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
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
- Paste the text to convert, or choose Use sample.
- Under Operation, choose Encode or Decode.
- Choose Convert.
- 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.