Escape and Unescape: JSON, JavaScript, Java, CSV, SQL

Escape or unescape text for JSON, JavaScript, Java and C# strings, CSV fields and SQL string literals.

About Escape and Unescape: JSON, JavaScript, Java, CSV, SQL

Escape text so it can sit inside a string literal in another language or format, and unescape it to get the original text back. Supported formats are JSON, JavaScript, Java and C# strings, a CSV field and an SQL string literal.

JSON escaping turns quotes, backslashes and line breaks into \" \\ and \n. CSV escaping wraps fields that contain commas, quotes or line breaks in double quotes and doubles any inner quote. SQL escaping doubles single quotes.

How to use it

  1. Pick the format and direction from the Mode menu.
  2. Paste the text to escape or unescape.
  3. Copy the result.

Questions

Is my text uploaded?

No. Everything runs in your browser; nothing you type or generate is sent to a server.

Is Java and C# escaping the same as JSON?

For the common characters (quotes, backslashes, newlines, tabs) yes. Java and C# also accept \uXXXX escapes that JSON produces for control characters.

How do I escape values for SQL?

Use the SQL string option, which doubles single quotes. Parameterised queries are still the safer choice in application code.

More Data & Converters tools

Home · All Tools · Blog