3

How do I add information to a multiple address schema markup with JSON-LD?

Here is my code:

<script type='application/ld+json'>
{
  "@context": "http://schema.org",
  "@type": "Apartments",
  "name": "***",
  "url": "***",
  "address":
  [
    {
      "@type": "PostalAddress",
                "streetAddress": "***",
             "addressLocality": "***",
                "addressRegion": "***",
             "postalCode": "***",
             "addressCountry": "Canada"
    },
    {
      "@type": "PostalAddress",
                "streetAddress": "***",
            "addressLocality": "***",
                "addressRegion": "***",
            "postalCode": "***",
            "addressCountry": "Canada"
    }
  ]
}
</script>

I would like to add information like geo-coordinates and business hours, but when I try and add it for the individual locations it gives me an error "Expecting 'EOF'" I was trying to add it under the addressCountry part of the code, I'm assuming I am placing it incorrectly.

{
          "@type": "PostalAddress",
                    "streetAddress": "***",
                "addressLocality": "***",
                    "addressRegion": "***",
                "postalCode": "***",
                "addressCountry": "Canada"
        },
"geo": {
    "@type": "GeoCoordinates",
    "latitude": "***",
    "longitude": "***"
  },
"openingHours": "Mo, Tu, We, Th, Fr 08:00-20:00 Sa, Su 10:00-16:00",

 "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "Sales",
    "telephone": "***"
}


      ]
    }
    </script>
3

First of all, about the Schema.org terms you use:

Your example uses the Apartments type, but that is not a valid type. You probably mean Apartment. But this type can’t have the openingHours property nor the contactPoint property. And neither can the PostalAddress have these properties, nor geo.

As it typically doesn’t make sense for an Apartment to have more than one address, I’m not sure if you are really using the correct types here.

Anyway, for providing opening hours, you can use openingHoursSpecification property (for Apartment) and the hoursAvailable property (for PostalAddress).

Now about your JSON-LD:

You cannot nest properties like that.

If you want to add properties to the PostalAddress nodes, you have to add them inside the { } of each PostalAddress. That means that you have to repeat them in case they are the same for both nodes.

  • It is a community village where the names of the "type of apartments" are sorted so "apartment type 1" is 2 buildings and has 2 addresses. If there is no solution then I will just add the opening hours to the main page of schema and forgo it here. Thanks for the input! – Kevin S Apr 5 '17 at 21:07
  • 1
    @KevinS: Can’t say I understand this yet. Anyway, if you want to provide the opening hours of the Apartment, you can use the openingHoursSpecification, and if you want to provide the opening hours of the address, you can use the hoursAvailable property. – unor Apr 5 '17 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.