JSON Escape / JSON Unescape

Oct 10, 2021

JSON escape tool converts JSON to string online by escaping special characters such as quotes, backslash and, other reserved characters. The escaped text can be used in JSON strings safely without making the JSON invalid. You can store HTML inside a JSON property by encoding control characters.

You can also use this tool to perform JSON unescape by changing the Operation setting.



Input: Paste input below

Settings

JavaScript Object Notation (JSON), pronounced as Jason, is the most common data interchange format on the web. Douglas Crockford first released the JSON specification in the early 2000s. It is a simple format that is easier to comprehend than XML. It is also smaller in size because it does not have closing tags. A wide variety of programming languages can parse JSON files. They also support the serialization of data structures to JSON. You can copy JSON text to JavaScript and start using them without any modifications.

JSON Unescape

Remove escape characters from JSON (unescape) to get back the original string. Reserved characters hold special meaning in the JSON format. These characters need to be escaped (or encoded) inside JSON strings. This online tool reverses the escaping process (decodes) and returns the original string.

JSON Escape Characters

We must encode the following reserved characters before using them inside JSON string values.

  • Tab\t
  • Newline\n
  • Carriage Return\r
  • Formfeed\f
  • Backspace\b
  • Double Quote\"
  • Next Line (U+0085)\u0085
  • Line Separator (U+2028)\u2028
  • Paragraph Separator (U+2029)\u2029

Tab
Tabs help indent JSON documents for better readability. We must convert the Tab character to \t inside JSON strings.
Newline
Newline provides clarity to JSON text by introducing vertical indentation. Just like the Tab character, Newline must be escaped inside JSON strings using a backslash \n.
Carriage Return
Carriage Return (CR) followed by Newline/Line feed (LF) make up a Newline on Windows systems. We write CR as \r.
Formfeed
Similarly, Form feed or FF converts to \f.
Backspace
The sparingly used Backspace character becomes \b.
Double Quote
The JSON format uses double quotes to surround string values. As such, we also escape double quotes and write it as \".
Next Line (U+0085)
The higher-order Unicode character, Next Line becomes \u0085. We follow \u by the Unicode value of 0085.
Line Separator (U+2028)
Similarly, Line Separator becomes \u2028.
Paragraph Separator (U+2029)
Finally, the Paragraph Separator converts to \u2029.

Read more at Wikipedia.

Settings Explained
  • 1. Operation

    The escape operation performs the Substitutions listed above. Unescape applies reverse substitutions. For example, \t becomes the Tab character.

    Escape

    This is a \"JSON\" text\nwith\nspecial characters like \\
    Microsoft Date Format

    This is a "JSON" text
    with
    special characters like \
Comments 0

History
Oct 7, 2017
Tool Launched