How to use

Getting started

  • Paste JSON, and the Escaped tab shows it as one escaped string: for SDKs and APIs that only take strings as values, or to put JSON inside JSON.
  • Paste escaped JSON, and the Unescaped tab turns it back into JSON.
  • The result updates as you type. Copy copies it, and Use as input puts it in the box to escape or unescape it again. Each tab has its own example.

Escaping

  • The JSON is checked first; when it isn't valid, the error says where. A tab or line break typed into a string is pointed out: JSON writes them \t and \n. Text that isn't meant as JSON can still be escaped as text.
  • A byte order mark at the start, which some Windows editors save, is left out.
  • Minify first takes out the spaces and line breaks between values. Nothing is rewritten, so numbers like 12345678901234567890 or 89.90 and repeated keys stay exactly as written.
  • With quotes puts the string in double quotes, ready for JSON or code. Escape non-ASCII writes é as \u00e9, for systems that only take ASCII.

In code

  • As a string in gives the JSON as a string literal for JavaScript / TypeScript, Kotlin, Java, Swift, Objective-C, Dart, C# or Python, with that language's escapes: $ is \$ in Kotlin and Dart, Swift writes \u{E9}, and Objective-C strings start with @. Copy code copies it, and the language is remembered.

Unescaping

  • The quotes around a whole string come off, and escapes like \", \n, \\ and \u00e9 (and JavaScript's \x41 and \u{1F680}) become characters again.
  • JSON escaped more than once (\\\") is unescaped until it's JSON again; the result says how many layers it took.
  • Pretty-print lays the JSON out on several lines, without rewriting any value. Open in JSON Path Viewer opens it there.

Sharing

  • Copy share link copies a link to this page with the text and tab in it, after a #. Whoever opens it sees the same result. A very long text makes a link that chat apps may cut off.

JSON Escape / Unescape

Turn JSON into an escaped string to use as a value, and escaped JSON back into readable JSON. Numbers and keys stay exactly as written, and the result updates as you type.