← All text tools

JSON Stringify and Unstringify

Escape JSON into a quoted string for code or logs, or turn an escaped and even double escaped JSON string back into readable JSON.

  • Free
  • No sign-up
  • Works on any device

About JSON Stringify and Unstringify

To put JSON inside a string in code, a log line or another JSON field, its quotes and backslashes must be escaped. Stringify does that for you and gives the result as a JSON string, a single-quoted JavaScript literal or a template literal, optionally escaped twice for text that passes through two layers. Unstringify goes the other way: it removes one or several layers of escaping from text such as "{\"a\":1}" and shows the readable, formatted JSON, telling you how many layers it removed.

How to use JSON Stringify and Unstringify

  1. Choose Stringify or Unstringify and paste your text.
  2. For stringify pick the quote style and the number of escape layers; for unstringify pick the output format.
  3. Copy the result, which is ready to paste into code or a viewer.

Why use this tool?

Also known as

Frequently asked questions

What is double escaped JSON?

It is JSON that was turned into a string twice, so every quote carries two backslashes. It appears when a logging system stores a JSON string that already contained an escaped JSON string.

Can I stringify text that is not valid JSON?

Yes. If the text cannot be parsed, it is escaped as plain text and a message says so. Only the minify option needs valid JSON, and it is skipped for other text.

Which quote style should I choose for JavaScript?

Double quotes give a string that is also valid JSON. Single quotes suit code styles that prefer them, and backticks keep line breaks readable in a template literal.

Is JSON Stringify and Unstringify free?

Yes. JSON Stringify and Unstringify on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

Can I put JSON Stringify and Unstringify on my own website?

Yes. Use the Embed on your site button under the tool to copy a short piece of code and paste it into your page. It is free, needs no account, and the tool keeps working inside your page.

Related tools