Escape / unescape JSON strings (no upload)

TL;DR: JSON strings can’t contain raw newlines/tabs. Escape to \\n / \\t, escape quotes as \\\", and validate locally.

When you embed plain text into JSON, you often need a JSON string literal with the right escapes. This guide shows the safe way to escape and unescape strings without uploading private data.

What is a “JSON string literal”?

In JSON, a string is wrapped in double quotes and uses backslash escapes. Example: "hello\\nworld". When parsed, it becomes a real newline between hello and world.

Common breakages (and why JSON.parse fails)

  • Raw newline inside quotes: JSON does not allow U+000A in a string.
  • Raw tab inside quotes: JSON does not allow U+0009 in a string.
  • Unescaped quotes: a " must be written as \\\".
  • Backslashes: a literal \\ must be written as \\\\.

Quick examples

Bad (raw newline in a string):

{"msg":"line1
line2"}

Good (escape as \\n):

{"msg":"line1\\nline2"}

Good (tab as \\t):

{"cols":"a\\tb\\tc"}

Fast no-upload workflow

  1. Escape or unescape locally with JSON String Escape/Unescape.
  2. Validate the full JSON with JSON Validator (strict JSON only).
  3. If your JSON has comments or trailing commas, normalize it with JSON Repair.

Trust note: All processing happens locally in your browser. Files are never uploaded.

FAQ

Why does my JSON look fine in a log but fails to parse? Logs often print escape sequences. Your actual JSON might contain a real newline/tab character inside a quoted string, which breaks strict JSON.

Can I paste secrets here? This site runs client-side only. Still, prefer redacting tokens/passwords before sharing output in chats/issues.

Privacy & Security
All processing happens locally in your browser. Files are never uploaded.

Next pages to check

Closest crawled pages without impressions yet. Added to speed first-impression conversion.

neighbor python go json cannot unmarshal string into field payload user type string runbneighbor csharp go json cannot unmarshal array into field payload user type string checkneighbor csharp go json cannot unmarshal array into field payload user type string checkneighbor csharp go json cannot unmarshal array into field payload user type string workfneighbor csharp go json cannot unmarshal array into field payload user type string workfneighbor csharp go json cannot unmarshal array into field payload user type string workfneighbor csharp go json cannot unmarshal array into field payload user type string workfneighbor csharp go json cannot unmarshal array into field payload user type string workfneighbor csharp go json cannot unmarshal array into field user id type string checklistsneighbor csharp go json cannot unmarshal array into field user id type string runbooks aneighbor csharp go json cannot unmarshal array into field user id type string runbooks wneighbor csharp go json cannot unmarshal array into field user id type string troubleshoneighbor csharp go json cannot unmarshal array into field user id type string troubleshoneighbor csharp go json cannot unmarshal array into field user id type string workflows neighbor csharp go json cannot unmarshal array into field user id type string workflows neighbor csharp go json cannot unmarshal array into field user id type string workflows neighbor csharp go json cannot unmarshal array into field user id type string workflows neighbor csharp go json cannot unmarshal array into field user id type string workflows