Find the syntax error that stops Google reading your markup

Unparsable structured data is the Search Console report for markup Google couldn't read because of a serious syntax error, so it couldn't even work out which type of rich result you intended. Every item the report lists is a critical error. Most of the error types it lists are JSON-LD mistakes, such as a missing comma, an unescaped quotation mark or a stray backslash, and one broken template can break the markup on every page that uses it.

What each parsing error points to

ErrorWhat to look for
Parsing error: Missing ',' or '}'A missing comma between two properties, or a quotation mark inside a value that ended the string early because it wasn't escaped.
Parsing error: Missing '}' or object member nameA comma after the last property in an object, which leaves the parser expecting another name, or a closing brace that never arrives.
Parsing error: Missing ':'A property name followed by its value with no colon between them, where the parser expected one.
Bad escape sequence in stringA backslash followed by a character JSON doesn't allow after one, such as a Windows file path pasted into a value.
Invalid JSON documentA problem at the top level, such as two objects one after the other with no array around them, or HTML inside the script block.
Duplicate unique propertyA property that may appear only once in an object, such as @context, defined twice in the same object.
Reference to nonexistent itemMicrodata whose itemref attribute names an id that doesn't exist anywhere on the page.

Why the markup breaks

  • A JSON string can't hold a raw quotation mark, backslash or control character, and line breaks count as control characters: RFC 8259 says each must be escaped. A template that drops a product title or description straight into the JSON breaks the first time that text has a quote or a new line in it. Google's report help says the most common cause of one error on many pages is an underlying template error.

  • Comments cause trouble too. The Rich Results Test ignores comments inside JSON-LD, but Google points out that the JSON-LD standard doesn't support them and they might cause errors in actual use, so take them out before publishing. The error names in the table come from the same Rich Results Test help.

Check every JSON-LD block on a page

# Save the HTML your server sends, then parse each JSON-LD block in it
# Markup that JavaScript adds after loading needs the Rich Results Test instead
curl -s https://yoursite.com/page-from-the-report -o page.html
python3 - page.html <<'EOF'
import json, re, sys
html = open(sys.argv[1], encoding="utf-8").read()
blocks = re.findall(r"<script[^>]*application/ld\+json[^>]*>(.*?)</script>", html, re.S | re.I)
for n, block in enumerate(blocks, 1):
    try:
        json.loads(block)
        print(f"Block {n}: valid JSON")
    except json.JSONDecodeError as e:
        print(f"Block {n}: {e.msg} at line {e.lineno}, column {e.colno}")
EOF

How to fix unparsable structured data

  1. Test an example URL from the reportEach error row lists affected pages. Run one through the Rich Results Test, which lists the problem under Syntax errors in items of unknown type and opens the code at that spot when you click it.
  2. Fix the template, not one pageFind the code that writes the block, so every page built from that code is repaired at once, not just the page you tested.
  3. Build the JSON with an encoderGenerate the block with your language's JSON serializer instead of joining strings, so quotes, backslashes and line breaks in your content are escaped for you.
  4. Narrow down a stubborn errorIf you can't spot it, Google suggests starting from an empty object and adding the original content back piece by piece until the error returns.
  5. Expect new issues once it parsesWhen Google can read the item, it can check its properties, and errors or warnings the syntax error hid can show up in that type's own report. Clear those, then validate.

Frequently asked questions

Why don't I see this report in Search Console?

Google shows it only for properties where it has found unparsable structured data, so its absence means Google hasn't found any on your site. The report help says so in its first lines.

Is this the same as the Rich Results Test's syntax errors?

Yes. The test lists the same error types under Syntax errors in items of unknown type, and gives a page with them the status Structured data with syntax errors detected. Rich Results Test help has the full list.

Will the errors clear on their own once I fix them?

They will as Google recrawls the affected pages, even if you never start validation. Clicking Validate fix gets you an email when Google confirms the fix on every URL, which typically takes up to about two weeks, according to the report help.