JSON String Escape

Escape special characters in strings for use in JSON. Converts newlines, quotes, backslashes, and other special characters.

Input String
Enter the text to escape for JSON
Escaped Output
JSON-safe escaped string

JSON String Escaping

When including strings in JSON, certain characters must be escaped with a backslash to be valid. This tool helps you escape and unescape strings for JSON.

Characters That Must Be Escaped

| Character | Escaped Form | Description | |-----------|-------------|-------------| | " | \" | Double quote | | \ | \\ | Backslash | | Newline | \n | Line feed | | Tab | \t | Horizontal tab | | Carriage return | \r | Return character | | Form feed | \f | Form feed | | Backspace | \b | Backspace |

Use Cases

  • API Development - Prepare strings for JSON payloads
  • Configuration Files - Escape strings for JSON config files
  • Database Operations - Escape data before JSON storage
  • Web Development - Prepare strings for JavaScript/JSON

Tips

  • Single quotes don't need escaping in JSON (but the string must use double quotes)
  • Unicode characters can be escaped as \uXXXX
  • Forward slashes can optionally be escaped as \/