Skip to content

Another spelling of the same bytes

Escape a JSON string

The result is a JSON string, including the quotes JSON.stringify adds.

Decoding accepts only a JSON string, not an object or a number.

The work stays in this tab.

This tool runs in your browser. Turn on JavaScript to use it.

JSON string

The sample is fixed. It uses the same rule as the form.

Input
a"b
Result
"a\"b"

How to use it

  1. 1Paste the text.
  2. 2Choose encode or decode.
  3. 3Copy the result.

Good to know

  • It does not format a whole document. That is the JSON page.
  • This page does not upload the text.
  • Text longer than one hundred thousand characters is rejected.

Questions

Does the result leave this browser?

No. The calculation finishes in the current tab.

What does this page leave out?

It does not format a whole document. That is the JSON page.

What if the input is huge?

Past one hundred thousand characters, the page stops and asks you to shorten it.

Related tools

  • Format and check JSON

    JSON is a data format with strict commas, quotes, and no comments. This page parses what you paste and prints it again with an indent, or on one line.

  • Escape text with backslashes

    Newlines, tabs, quotes, and backslashes become \n, \t, \", and \\.

  • Inspect Unicode code points

    A character you see may be one code point or several. This page lists the first 80 code points, with U+ notation, decimal, UTF-8 bytes, and a JavaScript escape.