Escape JSON Text

Updated: Sep 17, 2018
JSON   ESCAPING  

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



Substitutions

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.
 
Created: Oct 7, 2017
Online Tool Designed For: Windows, OS X, Android, iOS, Linux