Escape JSON Text

Sep 17, 2018 0 Comments

Use this online tool to escape (or encode) JSON string to make sure that special or reserved characters are encoded via proper escaping. The escaped text can be used in JSON strings safely without making the JSON invalid. Typical usage would be if you want to store HTML in a JSON property.

See Substitutions for more information.

Read more at wikipedia.

Input: Paste plain text below

Unescape JSON

Remove escape characters from JSON to get back the original string

View Tool
Background Information


The following characters are reserved in JSON and as such they must be escaped before they are used inside JSON string values.

Tab becomes \t
JSON documents can be indented for better readability. Tabs are typically used to indent child JSON nodes to the right thus showing the hierarchy of objects. Inside JSON strings, the Tab character must be converted to \t.
Newline becomes \n
Newline is also used to format JSON data for better understanding by us humans. Typically, a single JSON property is placed in a single line. Just like the Tab character, Newline must be escaped inside JSON strings using a backslash. So, the Newline character is converted to \n.
Carriage Return becomes \r
On Windows systems, Carriage Return (CR) followed by Newline/Line feed (LF) make up a newline. So, CR is escaped using the standard escape character of JSON strings, backslash.
Formfeed becomes \f
Form feed or FF is escaped by backslash so the output becomes \f
Backspace becomes \b
Back space is also escaped by backslash so the output becomes \b
Double Quote becomes \"
Double Quotes are what JSON strings are contained in. So, in order to represent double quotes literally inside JSON strings they too must be escaped by a backslash and become \"
Next Line (U+0085) becomes \u0085
Next Line is a higher order Unicode character that must be converted to \u followed by it's unicode value of 0085. The final output is \u0085.
Line Separator (U+2028) becomes \u2028
Line Separator is another character that must be converted to it's unicode format \u2028.
Paragraph Separator (U+2029) becomes \u2029
Finally, the Paragraph Separator is converted to it's unicode format \u2029.
Comments 0

Oct 7, 2017
Tool Launched