Need help with your JSON?
Try our JSON Formatter tool to automatically identify and fix syntax errors in your JSON. JSON Formatter tool
Handling Special Characters in JSON Strings
If you are asking what special characters JSON does not accept, the practical answer is short: inside a JSON string, raw double quotes, raw backslashes, and ASCII control characters from U+0000 through U+001F are not allowed as-is. They must be escaped. JSON also rejects made-up escape sequences such as \', \x41, or \v.
Everything else is less mysterious than it looks. Most punctuation is fine, single quotes are fine as data, forward slashes do not need escaping, and Unicode text such as accented letters, CJK characters, and emoji can appear directly in a valid JSON string.
Short Answer
- JSON strings must use double quotes. Single quotes are ordinary characters inside the data, not valid string delimiters.
- The only built-in short escapes are
\",\\,\/,\b,\f,\n,\r, and\t, plus Unicode escapes in the form\uXXXX. - A raw newline or tab inside a JSON string is invalid, but
\nand\tare valid escaped forms. - A forward slash
/is valid as-is. Escaping it as\/is optional.
Which characters are valid in JSON strings?
Per the current JSON specification, a string can contain any Unicode character except an unescaped double quote, an unescaped backslash, or characters in the U+0000 to U+001F range. That means most symbols people worry about, including @, #, % , &, *, <, >, and ', are fine in string values without extra escaping.
| Character or Case | Valid As-Is? | Correct Form | Notes |
|---|---|---|---|
| A-Z, a-z, 0-9, most punctuation | Yes | "name@example.com #1" | No special escaping needed. |
| " | No | \" | Must be escaped inside the string. |
| \ | No | \\ | Must be escaped inside the string. |
| / | Yes | / or \/ | Escaping the slash is optional. |
| Actual newline, tab, carriage return | No | \n, \t, \r | Raw control characters are invalid in JSON strings. |
| ASCII control chars U+0000-U+001F | No | \u0000 to \u001F | Must be escaped if you need to preserve them. |
| Unicode text and emoji | Yes | "こんにちは" or "\uD83D\uDE80" | Direct Unicode is allowed. Escaped Unicode is also valid. |
Valid escape sequences in JSON
JSON has a small, fixed escape set. If you put a backslash before some other character, the parser should reject it as a bad escape. This is one of the biggest differences between JSON and language string literals.
| Escape | Meaning | Accepted? |
|---|---|---|
| \" | Double quote | Yes |
| \\ | Backslash | Yes |
| \/ | Forward slash | Yes, but optional |
| \b | Backspace | Yes |
| \f | Form feed | Yes |
| \n | Line feed | Yes |
| \r | Carriage return | Yes |
| \t | Tab | Yes |
| \uXXXX | Unicode escape with exactly 4 hex digits | Yes |
| \', \x41, \v, \0 | Non-JSON escape sequences | No |
Common mistakes and how to fix them
1. Unescaped quotes inside a string
A raw double quote ends the JSON string early, so it must be escaped as \".
Invalid JSON
{
"message": "He said "hello" to me"
}Valid JSON
{
"message": "He said \"hello\" to me"
}2. Backslashes in paths and regular expressions
A backslash is always special in JSON. If you want a literal backslash in the resulting value, write it as \\. This is why Windows paths often break when copied into JSON.
Invalid JSON
{
"path": "C:\Users\sam\Documents\report.json"
}Valid JSON, wrong value
{
"path": "C:\new\test"
}That second example parses, but \n becomes a newline and \t becomes a tab, so the path is no longer what you meant.
Valid JSON
{
"path": "C:\\Users\\sam\\Documents\\report.json"
}Path Tip
If your application accepts it, using forward slashes can make paths easier to read in JSON because / does not need escaping.
3. Raw line breaks and tabs
JSON does not support multiline strings with literal line breaks inside the quotes. Use escaped control characters instead.
Invalid JSON
{
"description": "Line one
Line two"
}Valid JSON
{
"description": "Line one\nLine two"
}4. Escaping characters that JSON never asked you to escape
This is where many developers mix up JSON with JavaScript, Python, or shell escaping. In JSON, an apostrophe does not need escaping because strings are delimited by double quotes. Writing \' creates a bad escape. The same applies to \x41, \v, and \0.
| If You Wrote | Why It Fails | Use Instead |
|---|---|---|
| \' | Apostrophe is not a JSON escape sequence. | ' or \u0027 |
| \x41 | JSON does not support hex escapes in this form. | A or \u0041 |
| \v | Vertical tab is not one of JSON's short escapes. | \u000B |
| \0 | Null must use a Unicode escape in JSON. | \u0000 |
5. Single quotes around strings or object keys
JSON is stricter than JavaScript object literal syntax. Both string values and property names must use double quotes. This is invalid JSON:
{
'message': 'hello'
}Correct JSON would be {"message":"hello"}.
Does JSON accept Unicode, accented characters, and emoji?
Yes. Direct Unicode characters are valid in JSON strings, and escaped Unicode is also valid. If you escape a character outside the basic multilingual plane, use a surrogate pair such as \uD83D\uDE80 for the rocket emoji.
{
"greeting": "こんにちは",
"heartDirect": "I ❤️ JSON",
"heartEscaped": "I \u2764\uFE0F JSON",
"rocketEscaped": "\uD83D\uDE80"
}Unicode Interoperability Note
JSON exchanged between systems should normally be encoded as UTF-8. Also avoid lone surrogate code units such as \uDEAD; some software will accept them, but behavior can be inconsistent across parsers.
Common parser errors and what they usually mean
Different parsers phrase errors differently, but the same patterns show up again and again. If your formatter or parser reports one of the following, check the matching issue first.
| Typical Error | What to Check |
|---|---|
| bad control character in string literal | A raw newline, tab, or another character in the U+0000-U+001F range is inside the string. |
| bad escape character | A backslash is followed by a character JSON does not recognize, such as ', x, v, or 0. |
| bad Unicode escape | The \u sequence is malformed or not followed by exactly four hex digits. |
| expected property name or '}' | A key is unquoted or single-quoted instead of wrapped in double quotes. |
The safest way to avoid escaping mistakes
The best fix is usually not to hand-edit JSON at all. Build a normal data structure in your language and let a JSON serializer escape the string content for you.
const payload = {
message: 'He said "hello" to me',
path: "C:\\Users\\sam\\Documents\\report.json",
description: "Line one\nLine two"
};
const json = JSON.stringify(payload);- Use a real JSON library or serializer instead of concatenating strings by hand.
- Validate copied JSON before shipping it, especially when it contains paths, HTML, or multiline content.
- Remember that a backslash can make JSON invalid or silently change the value you meant to store.
- Prefer UTF-8 JSON for interchange and keep binary data out of strings unless you intentionally encode it.
For search users landing here directly, the main rule to remember is simple: JSON accepts almost all visible characters in strings, but it is very strict about quotes, backslashes, and low-value control characters. Once you know that small rule set, most "special character" bugs become easy to spot.
Need help with your JSON?
Try our JSON Formatter tool to automatically identify and fix syntax errors in your JSON. JSON Formatter tool