如何解决JSON-LD错误"Duplicate key found"?

How to solve the JSON-LD error "Duplicate key found"?

我的 Schema.org 在办公时间使用此代码,当我使用 https://search.google.com/structured-data/testing-tool

测试 URL 时出现错误

如何消除这个错误:

JSON-LD Duplicate key found.

我知道问题出在哪里:opensclosesdaysOfWeek,这些项目重复了。

我找到了 this solution,但我的问题与此不同。

请告诉我可能的解决方案,以便我相应地更改数据。

JSON-LD包含代码:

"openingHoursSpecification": {
"@context" : "http://schema.org",
"@type" : "openingHoursSpecification",
"opens" : "11:20 am ",
"closes": " 7:30 pm",
"dayOfWeek": {
"@context" : "http://schema.org",
"@type" : "dayOfWeek",
"name": "Mon"
},
"opens" : "10:20 am ",
"closes": " 7:30 pm",
"dayOfWeek": {
"@context" : "http://schema.org",
"@type" : "dayOfWeek",
"name": "Tue-Wed"
},
"opens" : "9:00 am ",
"closes": " 10:00 pm",
"dayOfWeek": {
"@context" : "http://schema.org",
"@type" : "dayOfWeek",
"name": "Thu"
},
"opens" : "11:00 am ",
"closes": " 4:00 pm",
"dayOfWeek": {
"@context" : "http://schema.org",
"@type" : "dayOfWeek",
"name": "Fri"
},
"opens" : "6:00 am ",
"closes": " 6:00 pm",
"dayOfWeek": {
"@context" : "http://schema.org",
"@type" : "dayOfWeek",
"name": "Sat"
},
"opens" : "10:00 am ",
"closes": " 11:40 pm",
"dayOfWeek": {
"@context" : "http://schema.org",
"@type" : "dayOfWeek",
"name": "Sun"
}},

您找到的解决方案也适用于您的情况。如果 属性 有多个值,则需要 :

"openingHoursSpecification": [
  {
    "@type": "OpeningHoursSpecification"
  },
  {
    "@type": "OpeningHoursSpecification"
  },
  {
    "@type": "OpeningHoursSpecification"
  }
],