Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Error loading remote context #150

Unanswered
spartahawk asked this question in Q&A
Mar 21, 2022 · 1 comments · 2 replies
Discussion options

I'm trying to make use of json-ld.net expansion and contraction given the json-ld formatting I'm seeing from major retailers. Are you aware of a discrepancy that follows?

In the repo readme, the example for expansion in the installation uses this example for the json-ld to be expanded:

{"@context":{ "test":"http://www.example.org/"},"test:hello":"world"}

However the major retailers I've looked at have it in something like the following format:

{"@context":"https://schema.org/", "@type":"Product", "image":"https://exampleimage.jpeg/",
 "name":"fake product name", "sku":"2345624623", ...}

So rather than have context be an object containing name/value pairs with what looks like individualized contexts for each thing we could expand, these retailers just list a single context url that I assume is supposed to be applied to everything else in the json-ld.

The Expand() method doesn't properly process inputs that don't have context as an object. It gives the error: error loading remote context

So my question is whether I'm needing to provide something more for Expand() to properly assign context to each name/value pair in the json-ld contents based on the single context url these retailers provide, or if I'll have to tweak the incoming json-ld format in order to feed it to the expand algorithm in a way it can process properly.

Please let me know if I'm misunderstanding. I'd be happy to hop on a quick call via Zoom or whatever if that's fastest for you. Thanks so much.

The way this library is expecting the context to be formatted doesn't seem to match google's structured data examples for products, nor any of the retailers I've looked at. So it's a bit confusing. https://developers.google.com/search/docs/advanced/structured-data/product#single-product-page

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

That appears to be the result of JSON-LD.NET not yet supporting JSON-LD 1.1. If you try your example in the JSON-LD 1.0 playground, you get a very similar failure.

You must be logged in to vote
2 replies
Comment options

Thanks @sblom . Any suggested workaround? 1.1 is everywhere now.

Comment options

sblom Mar 21, 2022
Collaborator

Unfortunately I haven't even looked at 1.1 (I've been mostly away for a while). If the only problem is the @context syntax, I imagine a trivial preprocessing step could get you to a 1.0-style context description.

The ubiquity of 1.1 is a good point. I don't know of any current efforts to modernize this library, but I would heavily assist anyone who was motivated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /