Skip to content
Oblicznik

Practical guide

How to use JSON Escape and Unescape without double encoding

Quotes or newlines in text do not have to break JSON. This guide explains which encoding layer you are working with, exactly what the tool copies and when your application’s library should handle encoding.

Oblicznik editorial teamReviewed: 1 October 2026

Escape accepts plain text

Choose Escape, paste plain text and select “Process”. Output is a complete JSON string literal including opening and closing quotes. Do not add quotes around the input unless they genuinely belong to the text. The tool does not build an object or add a member name.

Quotes and backslashes receive escape sequences. A newline becomes the literal’s backslash-n sequence rather than a physical line break. Ordinary Polish letters and valid emoji can remain readable. Leading and trailing spaces belong to the data and are not trimmed.

Escape examples
Plain textJSON literal
Zażółć"Zażółć"
A"B"A\"B"
C:\Temp"C:\\Temp"
A B"A\nB"

Unescape decodes one layer

Choose Unescape and paste one JSON string literal, including its outer double quotes. Output is plain text without those outer quotes. A whole object, array or standalone number is not accepted. For an API response, extract the needed member in your application rather than arbitrarily removing structural characters.

A backslash-n escape becomes a newline after one layer, but an escaped backslash followed by n becomes literal backslash and n. Do not repeatedly unescape until the result “looks right”. Further decoding can alter intended text, such as an instruction demonstrating escape notation to a user.

One Unescape layer
Input literalOutput text
"A\nB"A B
"A\\nB"A\nB
"\u0141ódź"Łódź
""Empty text

Avoid double encoding in an application

When a library serializes a whole object, it generally needs the original value text. If given Escape output as an ordinary string value, it will encode those quotes and backslashes again. The receiver can then see an extra layer. Establish whether the destination expects plain text or an already serialized JSON document.

In a manually prepared fragment, a complete literal can serve as a value, for example {"city":"Łódź"}. Do not surround the copied literal with another pair of quotes. Validate the assembled document with the formatter, then check its type in the destination application. Syntax alone does not establish API compatibility.

This is not HTML encoding or encryption

JSON escaping neither URL-encodes nor Base64-encodes or encrypts data. Text such as <b>Łódź</b> retains those characters. Output is not an HTML or JavaScript fragment safe for arbitrary embedding. Choose encoding for the destination context, not merely for how the text looks.

This tool’s preview displays text rather than executing HTML. That is a property of this interface, not a security guarantee for output used elsewhere. Use your application’s safe text-rendering mechanism before displaying it on a page; Escape alone does not remove scripts or unsafe addresses.

Empty text, Unicode and limits

An empty field is rejected, but unescaping the literal "" produces a valid empty result that can be copied. Do not confuse it with an error. A literal containing an unescaped physical newline, unknown escape or missing closing quote is invalid. Valid Unicode surrogate pairs are supported; unpaired surrogates are rejected.

Input is capped at 50,000 UTF-16 units, not bytes or visible characters. Output has a 500,000-unit cap because encoding can enlarge text. Errors do not yield partial results. For longer material, use a suitable local environment rather than splitting a literal inside an escape sequence.

Privacy, copying and reset

Paste only the necessary, anonymized passage. Input and output are processed in the browser without submission to analytics or localStorage/sessionStorage history. Visiting the page still connects to hosting. Local processing cannot protect against browser extensions, an insecure device or accidental clipboard sharing.

Editing a field clears the previous result; run the tool again after a correction. Copying is a separate action. Reset clears the form and restores options but cannot remove earlier clipboard copies, printouts or documents. Report issues with a short synthetic example and expected output, not a complete production API response.

Frequently asked questions

Does Escape output include outer quotes?

Yes. It is a complete JSON string literal. Copying keeps those quotes without labels.

Will Unescape decode a whole object?

No. It accepts a single string literal. Use the JSON formatter to check an object.

Does Escape remove unsafe HTML?

No. It encodes a JSON string literal; it is not HTML sanitization, encryption or universal XSS protection.

Does reset remove clipboard text?

No. It clears the form, not user-created copies. Remove those separately if they contain sensitive data.

Sources and scope

This guide explains the tool and its limits, not compliance with an API, JSON Schema or business rules. Use examples without confidential data and verify output in its destination system. Limits and additional rejections are implementation choices, not universal JSON requirements.

Tools covered by this guide

Calculator

JSON comparison

Compare two JSON documents and find added, removed or changed members using JSON Pointer paths.

Generator

JSON escape and unescape

Turn plain text into a quoted JSON string literal or decode one layer of JSON escape sequences.