Incorrect value type "@context" in Google Rich Results Test

aus*_*usi 7 json-ld google-rich-snippets

Im pretty new to JSON-LD and am currently struggling making the Google Rich Results Test happy with my custom JSON-LD data.

Every time I use a @context other than https://schema.org/ it shows me the error Incorrect value type "@context".

This even happens with this simple example based on a json-ld.org context:

<script type="application/ld+json">
{
  "@context": "https://json-ld.org/contexts/person.jsonld",
  "@type": "Person",
  "name": "Foo"
}
</script>
Run Code Online (Sandbox Code Playgroud)

Rich Results Test Error

After some trail and error I found out that with the following code the json-ld.org/playground shows me the same result if I use @vocab

<script type="application/ld+json">
{
  "@context": {"@vocab": "http://xmlns.com/foaf/0.1/"},
  "@type": "Person",
  "name": "Foo"
}
</script>
Run Code Online (Sandbox Code Playgroud)

And although Google is happy with this code I’m very uncertain if this can or should be the right solution to fix this kind of “Structured data parsing error”?

What is the correct way (that is accepted by Google) to write non-schema.org JSON-LD data?

fri*_*zmg 1

Dan Brickley(负责 Schema.org 的 Google 员工)表示,新验证器将解决或记录这些问题:

谢谢 - 注意到并承认。该工具不是开源的(它是 Google 结构化数据验证基础设施提供的视图)。在我们从 Schema.org 更显着地链接新验证器之前,我将确保这些问题得到解决或记录。

https://github.com/schemaorg/schemaorg/issues/2921#issuecomment-879817283