JSON Validation and Common Errors/Raw newlines inside strings are invalid

Use `\n` rather than an actual line break inside a string literal.

Section: Common parse failures

Raw newlines inside strings are invalid

json
json
{
  "text": "line 1\nline 2"
}
Explanation

A raw line break inside the quotes breaks parsing.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Common parse failures
Single quotes are invalid
Strings and keys must use double quotes.
OpenIn sheetjsonsame section
Trailing commas are invalid
Do not leave a comma after the last item.
OpenIn sheetjsonsame section
Object keys must be quoted
Bare identifiers are invalid in JSON.
OpenIn sheetjsonsame section
Rewrite valid JSON in normalized form
Read and immediately re-emit clean JSON.
OpenIn sheetbashsame section
Validate with jq
Parse a file and fail if JSON is invalid.
OpenIn sheetbash1 tag match
Validate with Python json.tool
Check syntax and pretty-print if valid.
OpenIn sheetbash1 tag match