JSON String Escaper

By the ToolPocket team · Updated 2026-12-05 · Editorial standards

Embedding text in JSON requires escaping quotes, backslashes and control characters. Forgetting one produces invalid JSON that is hard to debug, especially when the text itself contains JSON.

This tool turns plain text into a properly quoted and escaped JSON string literal, and does the reverse for a literal you paste. It runs locally.

Runs locally in your browser — nothing is uploaded.

How to use the JSON String Escaper

  1. Choose Escape or Unescape.
  2. Paste the text or the quoted literal.
  3. Copy the result.

Frequently asked questions

Why does the output have quotes?

A JSON string is always quoted. The escape mode returns the complete literal, ready to paste as a value.

What does Unescape accept?

A quoted JSON string literal, with or without the surrounding double quotes.

What about newlines?

Escape mode turns real newlines into \n so the value stays on one line.

Good to know

JSON escaping is close to JavaScript string escaping but not identical: JSON allows \u escapes for control characters and requires double quotes, while JavaScript also accepts single quotes and template literals.

Double-escaping is the usual bug: a string escaped twice shows literal backslashes in the UI. If the output looks wrong, check whether the value was already escaped upstream before it reached this page.