Skip to content

JSON Escape and Unescape

Escape text for a JSON string, or turn it back.

  • 100% Free
  • No Sign Up
  • Works in Your Browser

JSON escape/unescape

Escape text for a JSON string

More Developer Tools

View all tools

Every everyday developer tool, right in your browser.

No installs. No uploads. No signup.

Browse all 36 tools
Developer tools
36
Cheat sheets
10
Bytes uploaded
0

How to use the JSON escape/unescape

Three steps, all in your browser.

  1. 1

    Paste your input

    Type or paste your code or data. Press Sample to try an example.

  2. 2

    Choose the direction

    Encode or decode. Errors point at what's wrong with the input.

  3. 3

    Copy the result

    Copy the output in one click. Nothing is saved or sent anywhere.

JSON Escape and Unescape: what to know

JSON escape turns any text into a valid JSON string body: double quotes become \", backslashes become \\, and line breaks, tabs and other control characters become \n, \t and \u escapes. Unescape does the opposite, turning a JSON string value back into the original text with real line breaks and quotes.

It's handy whenever you need to put multi-line text, such as a SQL query, an HTML snippet, a certificate or a log message, inside a JSON document by hand, or when you're reading a JSON value full of \n and \" and want to see the text it represents. The rules come from the JSON specification (RFC 8259), so the result works in any JSON parser.

Characters outside ASCII, such as accented letters and emoji, don't need escaping in JSON encoded as UTF-8, so they're left as they are. Escaping the forward slash is optional in JSON, and isn't done here.

Popular uses

  • Putting multi-line text into a JSON config or request body
  • Reading escaped strings in logs and API responses
  • Embedding HTML or SQL inside JSON test fixtures
  • Preparing strings for environment variables that hold JSON

Tips for the best result

  • Escape only the string content; the surrounding quotes are added when you place it in JSON.
  • Seeing \\n instead of \n means the text was escaped twice.
  • Windows line endings come out as \r\n; that's expected.

Read how JustYourDev works and our privacy details. Code, data and files you use here are processed in your browser and are never sent to our server.

Frequently asked questions