0

My Schema.org having this code for office hours and that gives me error when I test the URL using https://search.google.com/structured-data/testing-tool

How I can remove this error:

JSON-LD Duplicate key found.

I know where is the problem: opens, closes, daysOfWeek, these items are repeated.

I found this solution, but my problem having different scenario than this.

Please let me know the possible solution, so that I can change the data accordingly.

JSON-LD includes code:

"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"
}},
unor
  • 92,415
  • 26
  • 211
  • 360
VBMali
  • 1,360
  • 3
  • 19
  • 46
  • 1
    Note that Schema.org terms are case-sensitive. The type has to be [`OpeningHoursSpecification`](http://schema.org/OpeningHoursSpecification), the property has to be [`openingHoursSpecification`](http://schema.org/openingHoursSpecification). And it’s [`DayOfWeek`](http://schema.org/DayOfWeek) (not `dayOfWeek` nor `daysOfWeek`). And you don’t need to repeat the `@context` if you can specify it once at the top (assuming that you don’t use other vocabularies in addition). – unor Apr 24 '18 at 17:30
  • Thank you for this information. Still wants to ask, why structure data testing tool not gives me error about that? – VBMali Apr 25 '18 at 06:18
  • My another question is: Will it make any difference Mon and Monday, Sat and Saturday, etc? – VBMali Apr 25 '18 at 06:39
  • Ah, I missed this when posting my previous comment: It’s not intended to use `dayOfWeek` like that. You should specify it like that: `"dayOfWeek": {"@id": "http://schema.org/Monday"}`. – unor Apr 25 '18 at 12:53

1 Answers1

2

The solution you found applies to your case, too. If a property has multiple values, you need to use an array:

"openingHoursSpecification": [
  {
    "@type": "OpeningHoursSpecification"
  },
  {
    "@type": "OpeningHoursSpecification"
  },
  {
    "@type": "OpeningHoursSpecification"
  }
],
unor
  • 92,415
  • 26
  • 211
  • 360
  • My error has been removed by Appling above solution, my another question is: Will it make any difference Mon and Monday, Sat and Saturday, etc? – VBMali Apr 25 '18 at 06:39