Trakis

Trakis · Rules

Invalid JSON-LD

JSON-LD blocks that are not valid JSON. An empty block says nothing and is left alone. A block that does not parse is thrown away whole: the page loses everything it tried to say, a product’s price, an article’s date, and nothing on screen shows it. The page itself is read and indexed as before.

WarningSTRUCT-002 · Structured data · checked on every page

Invalid JSON-LD: the errors that break a block, and how to stop them

Updated 17 October 2026.

JSON-LD is structured data written as JSON inside a <script type="application/ld+json"> tag, the format Google recommends (Google). JSON is strict: one misplaced comma and the whole block cannot be read. Nothing on the page shows it, so a broken block can sit there for years. This check finds blocks that do not parse.

The errors that break a block, each one rejected by a JSON parser:

{ "@type": "Product", "name": "Boot", }        a comma after the last item
{ '@type': 'Product' }                       single quotes
{ "name": "The "Harbour" boot" }              a quote inside a value, not escaped
{ "name": “Harbour” }                          curly quotes from a word processor
{ "description": "Line one
  line two" }         a line break inside a value
{ "@type": "Product" } { "@type": "Offer" }    two objects side by side
{ "@type": "Product" /* note */ }            a comment

Each has the same fix: write valid JSON. A quote inside a value is \", a line break \n; two objects go in an array, or in one @graph.

Where they come from. Almost never from a person typing JSON. From a template that glues strings together, a product description with quotes pasted into it, a CMS field that adds curly quotes, or two plugins writing into the same block. The lasting fix is to stop building JSON by hand: let the language write it, JSON.stringify in JavaScript, json_encode in PHP, json.dumps in Python. They escape what needs escaping, every time.

Ours, as it is. trakis.io builds each block as an object and lets JSON.stringify write it, then makes one more change: every < becomes \u003c, so that a value containing </script> cannot end the tag early and spill the rest into the page. A test checks exactly that.

export function serializeJsonLd(data: unknown): string {
  return JSON.stringify(data).replace(/</g, '\\u003c');
}

Check it yourself. The Schema Markup Validator (validator.schema.org) points at the line where a block breaks; Google’s Rich Results Test, which Google asks you to use while building, says whether the page can have a rich result at all.

How the audit decides.

  • It reads every application/ld+json script on the page and parses it as JSON, as any parser would. A block that fails is STRUCT-002, a warning, with the parser’s message and the start of the block as evidence.
  • An empty block says nothing and breaks nothing, and is left alone. Until 17 October 2026 it was “invalid JSON”, and the check was critical; the page itself is read and indexed as before, so it is a warning now.
  • It checks that the JSON is readable, not that it says the right things: a block with no @type is STRUCT-003; a Product without a price, STRUCT-004; a page with no structured data at all, STRUCT-001.

Sources, read on 17 October 2026: Google Search Central, Introduction to structured data markup in Google Search.

How common it is

In our study of 330 small sites, read from Common Crawl’s October 2026 archive (up to 100 pages a site), 6.1% of them had this problem on one page or more.

Where it usually comes from

Hand-edited blocks with a missing comma or quote, product descriptions with quotes pasted into the JSON without escaping, or two plugins writing into one block.

How to fix it

  • Paste the block into a JSON validator to find the broken character — usually a stray comma or an unescaped quote.
  • Fix it in the template or plugin that writes it, then test the page in Google’s Rich Results Test.

How to check it yourself

Paste the page address into the Schema.org validator; it points at the line where the JSON breaks.

What it looks like in a report

Warning A JSON-LD block cannot be parsed, so everything in it is lost: a parser reads a block whole or not at all. · evidence: Expected double-quoted property name at position 412

One broken character throws away the whole block, usually a trailing comma. (An example shop; the numbers are illustrative.)

How the audit counts it

STRUCT-002 is a warning in the structured data category, and weighs moderately in that category’s score. When it appears on many pages built from the same template, the report shows it once, with the number of pages it covers — because one change in the template fixes all of them.

If the finding is deliberate on your site, it can be accepted as intentional in the report. It then leaves the list and the score, and comes back on its own if what it shows changes.

Other structured data checks

Find it on your site

A free Trakis audit runs this check and the other 66 on your site, and tells you on how many pages each one sits. Or go back to all the rules.