I am trying to create some JSON-LD structured data for a list of products on an ecom-site but I am getting an error when using Google's Structured Data Testing Tool.
So far, I have this:
{
"@context": "http://schema.org",
"@type": "OfferCatalog",
"name": "Fresh Fruit",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item":
{
"@type": "Offer",
"price": "1.20",
"priceCurrency": "GBP",
"availability": "http://schema.org/InStock",
"url": "http://example.com/green-apples/",
"itemOffered": {
"@type": "Product",
"name": "Green Apples",
"url": "http://example.com/green-apples/"
}
}
}
]
}
Mostly it validates, but the Google tool throws the following error:
All values provided for url must point to the same page.
The error highlights line 11 ("@type": "Offer",
).
The URL fields seem to be clashing with the (This has been shown to be a red-herring, in the comments below)@context
declaration, because if I change the context to either a non-url string or http://example.com
, it validates (although, this obviously causes its own issues).
What am I missing here? It feels like something blindingly obvious.