Ad

Is It Ok To Nest (when Possible) JSON-LD Schema.org Reference?

- 1 answer

Do search engines treat both examples the same?
If yes, is there any reason to choose one over the other?
If no, what are the differences?

Not nested structured data:

[{
    "@context": "http://schema.org",
    "@type": "WebPage",
    ...
},{
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
    ...
},{
    "@context": "http://schema.org",
    "@type": "VideoObject",
    ...
}]

Nested structured data:

[{
    "@context": "http://schema.org",
    "@type": "WebPage",
    "breadcrumb": {
        "@type": "BreadcrumbList", 
        ...
    },
    "video": {
        "@type": "VideoObject",
        ...
    },
    ...
}]
Ad

Answer

They are not equivalent.

The first example only conveys that there are three entities: a WebPage, a BreadcrumbList, and a VideoObject. But they are not related in any way.

The second examples conveys that there are three entities (the same as in the first example), but they are related (thanks to using the properties breadcrumb and video): the Webpage entity has breadcrumbs and an embedded video.

So using the second example is of course preferable.

Note that you don’t have to nest to convey this. You can also use the structure from the first example and give each node a URI (with @id) and then use these URIs as values for the properties (example). But nesting might be better supported by consumers.

Ad
source: stackoverflow.com
Ad