3

I am guessing Google structured data testing tool behaves strange.

I wrote a code to create JSON-LD for multiple locations for one of my websites. But Google testing tool returns an error:

Missing '}' or object member name.

The error is related to missing }, or ], but that's not all right. Because the syntax is correct.

Below is the code I used, maybe others are also in the same condition these days:

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "LocalBusiness",
"name": "Company",
"url": "http://www.example.com",
[
{"address": {
    "addressLocality": "United Arab Emirates",
    "addressRegion": "Dubai",
    "streetAddress": "Building 213",
        "telephone" : "04 444 5555"
     "openingHours": ["Su, Mo,Tu,We,Th, 09:00-18:00"],
    },

{"address": {
    "addressLocality": "Jordan",
    "addressRegion": "Amman",
    "postalCode":"XXXXXXX",
    "streetAddress": "Building 213"
     "openingHours": ["Su, Mo,Tu,We,Th, 09:00-18:00"],
    },



{"address": {
    "addressLocality": "Lebanon",
    "addressRegion": "Beirut",
    "streetAddress": "Building 213",
    "telephone" : "+961 444 5555"
     "openingHours": ["Su, Mo,Tu,We,Th, 09:00-18:00"],
    },


{"address": {
    "addressLocality": "Qatar",
    "addressRegion": "Doha",
    "streetAddress": "Building 213",
    "telephone" : "+1(503) 444 5555"
     "openingHours": ["Su, Mo,Tu,We,Th, 09:00-18:00"],
    },

{"address": {
    "addressLocality": "Saudi Arabia",
    "addressRegion": "Riyadh",
    "streetAddress": "Building 213",
        "telephone" : "+966 1 4444 5555"
     "openingHours": ["Su, Mo,Tu,We,Th, 09:00-18:00"],

    },

{"address": {
    "addressLocality": "Egypt",
    "addressRegion": "New Cairo",
    "streetAddress": "Building 213",
        "telephone" : "+20 2 44445555"
     "openingHours": ["Su, Mo,Tu,We,Th, 09:00-18:00"],

    }
],

"description": "Company description",
"email":"support@example.com",
"logo": "http://www.example.com/w-logo.png",
"sameAs" : [ "https://www.facebook.com/Example",
"https://twitter.com/Example",
"https://plus.google.com/+Example",
"https://www.youtube.com/user/Example",
"http://www.slideshare.net/Example",
"https://www.linkedin.com/company/Example"]
}
</script>
unor
  • 21,739
  • 3
  • 46
  • 117
Julia
  • 61
  • 4
  • 3
    "the syntax is correct." - I'm curious why/how you think the syntax is correct - did you use a validator; which one? (Because the syntax is obviously not correct?) – DocRoot Dec 13 '16 at 17:33
  • 1
    As DocRoot suggests, running your JSON through a validator or parser will show you a number of errors with it. One simple quick test you can perform is to count the number of opening { and closing } braces - you have 13 opening but only 7 closing - they should be equal. – Zhaph - Ben Duguid Dec 15 '16 at 19:39

1 Answers1

5

If you want to provide multiple addresses, you have to specify one address property with an array value, not an array of address properties.

If you click at the error in the SDTT, the tool correctly highlights the line where the error begins (line 7, i.e., the opening [).

unor
  • 21,739
  • 3
  • 46
  • 117
  • 1
    There would seem to be some more errors as well... missing commas after several property values and erroneous commas after the last property (as if it's been manually edited?). – DocRoot Dec 13 '16 at 17:30