Skip to content

Rule · AI search

JSON-LD block is not valid JSON

geo/jsonld-parse-errorerrorvoid geoupdated

Why it matters

Parsers discard the whole block, so the page loses every entity, breadcrumb and article signal in it. This is a scoring gate.

How to fix it

Generate JSON-LD with JSON.stringify from an object, never by string concatenation, and escape < (see example).

Example

tsx
// components/json-ld.tsx (Server Component). JSON.stringify doesn't escape "<", so a string containing
// </script> would break out of the tag; replace it with the JSON escape \u003c.
import type { Graph, Thing, WithContext } from 'schema-dts'

export function JsonLd({ data }: { data: WithContext<Thing> | Graph }) {
  return (
    <script
      type="application/ld+json"
      dangerouslySetInnerHTML={{ __html: JSON.stringify(data).replace(/</g, '\\u003c') }}
    />
  )
}

References

void geo reports 41 rules in this category. Generative-engine optimisation: whether AI crawlers that don't run JavaScript see the same content, valid and visible JSON-LD, an explicit AI robots policy, llms.txt, Markdown mirrors and answer-first writing.