Free Toolkit

JSON Escape/UnescapeEscape text for JSON strings or unescape JSON string values.

JSON Escape/Unescape illustration
📝

JSON Escape/Unescape

Escape text for JSON strings or unescape JSON string values.

How to Use
1

Paste Text

Paste text to escape or a JSON string to unescape.

2

Choose Mode

Select Escape or Unescape mode.

3

Copy Result

Copy the escaped or unescaped text.

What Is JSON Escape/Unescape?

The JSON Escape/Unescape tool converts text for safe use in JSON strings (escape mode) or extracts the original text from JSON string values (unescape mode). In escape mode, it wraps the input in quotes and escapes special characters like newlines (\n), tabs (\t), backslashes (\\), and quotes (\""). In unescape mode, it parses a JSON string value and returns the original unescaped text. This uses JavaScript's native JSON.stringify and JSON.parse for standard-compliant conversion.

Why Use Our JSON Escape/Unescape?

  • Prepare text for insertion into JSON documents
  • Extract readable text from JSON string values
  • Handle special characters in JSON correctly
  • Debug JSON strings with escape sequences

Common Use Cases

API Development

Escape text content for JSON API request bodies.

Configuration

Escape multi-line text for JSON configuration files.

Debugging

Unescape JSON strings to see their actual content.

Data Processing

Convert between escaped JSON strings and plain text.

Technical Guide

In escape mode, the tool uses JSON.stringify() which produces a JSON-compliant string representation. This escapes backslashes to \\, double quotes to \", newlines to \n, carriage returns to \r, tabs to \t, and control characters to \uXXXX unicode escapes. The output includes surrounding double quotes as required by JSON syntax. In unescape mode, JSON.parse() is used to interpret the input as a JSON value. If the input is a valid JSON string (with quotes), it returns the parsed string. If parsing fails, an error message is shown. This ensures standard-compliant JSON string handling in both directions.

Tips & Best Practices

  • 1
    Escape mode wraps output in double quotes — this is correct JSON string format
  • 2
    Unescape mode expects a JSON string value (usually with surrounding quotes)
  • 3
    Use this when building JSON manually or debugging API responses
  • 4
    Control characters and Unicode are handled automatically

Related Tools

Frequently Asked Questions

QWhy does escape mode add double quotes?
JSON strings must be enclosed in double quotes. The output is a valid JSON string value.
QWhat characters are escaped?
Backslash, double quotes, newlines (\n), carriage returns (\r), tabs (\t), and control characters.
QCan I unescape an entire JSON object?
The unescape mode works on JSON string values. For objects, it will pretty-print them.
QDoes it handle Unicode?
Yes, non-ASCII Unicode characters are preserved in escape mode (JSON.stringify keeps them as-is).
QWhat if unescape shows an error?
The input must be valid JSON. Ensure strings are wrapped in double quotes and escape sequences are correct.

About JSON Escape/Unescape

JSON Escape/Unescape is a free online tool from FreeToolkit.ai. All processing happens directly in your browser — your data never leaves your device. No registration required. No ads. Just fast, reliable tools.