Loona Automation logoLoona Developer Tools
Home › Encoders & Decoders

JSON String Escape

In short: escape any text so it can sit safely inside a JSON string value — quotes, backslashes, tabs and newlines become their backslash sequences.
🔒 Private by design: everything runs in your browser on this device. Your input is never uploaded to a server.

Example

Input:

He said "hi"
New line

Output:

He said \"hi\"\nNew line

About this converter

Building JSON by string concatenation breaks the first time a value contains a quote or a newline — escaping is the fix, and this page does exactly the JSON string escaping rules: \" for quotes, \\ for backslashes, \n \r \t for the whitespace controls, and \uXXXX for other control characters. Non-ASCII characters are left as-is (JSON is Unicode text; escaping them is optional and harms readability). Paste the output between the quotes of a JSON string value, or wrap it in quotes for a complete literal. If you are doing this often in code, use your language's JSON serializer instead — hand-built JSON is a bug farm, and this page is the bandage, not the cure.

Frequently Asked Questions

Does it escape Unicode like é?

No — JSON strings carry Unicode natively. Only the structurally dangerous characters (quote, backslash, controls) are escaped.

What is the result for a tab?

The two characters \t — JSON's escape for the tab character.

Related Developer Tools

Embed this tool on your website — free

Add this tool to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the tool to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.