Your JSON-LD is probably inside a @graph, and most parsers don't look there
There are two shapes a page can hand you its structured data in, and if you only handle the first one you will report that a correctly marked-up page has no structured data at all. Shape one, the one every tutorial shows: { "@context" : "https://schema.org" , "@type" : "Article" , "headline" : "..." } Shape two, the one a large share of the real web actually emits: { "@context" :…
Structured data, such as JSON-LD, can be presented in two different shapes. The first shape, which is commonly shown in tutorials, follows a specific format with top-level elements like @context, @type, and headline. However, a significant portion of actual web pages emit a second shape, which is less commonly understood. This second shape, often referred to as @graph, does not contain a top-level @type element.
Many popular SEO plugins, such as Yoast SEO and RankMath, default to emitting data in the @graph format, and there is no option for a flat output. This means that a large fraction of WordPress sites with SEO plugins will have their structured data presented in the @graph shape. Additionally, the @graph format allows for more efficient referencing between entities by using @id, creating a single entity graph instead of multiple disconnected ones.
The issue lies in parsers that are unable to properly handle the @graph format. When a parser only checks for the presence of @type at the top level, it will incorrectly report that a page with valid @graph data has no structured data at all. This explains why nine out of twelve structured-data detectors tested were unable to detect structured data when it was presented in the @graph format.
To resolve this issue, it is recommended to flatten the JSON-LD data before inspecting it. This can be done by writing a function that iterates through the JSON-LD data at any nesting depth, yielding every schema.org node. The function should handle both flat JSON-LD data and data wrapped in a @graph, running the @graph check before the @type check.
By flattening the data at the parse boundary, downstream checks will no longer need to differentiate between the two shapes, ensuring that structured data is correctly identified and interpreted.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.