Multiple addresses in JSON-LD Schema.org

9,189

Solution 1

Similar to adding multiple string/URL values: by using an array.

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Organization",
  "address":
  [
    {
      "@type": "PostalAddress"
    },
    {
      "@type": "PostalAddress"
    }
  ]
}
</script>

Solution 2

I know this question is four years old, but I'm pretty sure there is an even better way to announce multiple addresses under an @organization.

Firstly, since Schema.org doesn't have an itemProp specifically for headquarters info, the closest thing is (like described in the above answer) use address to add the NAP for the headquarters's location. Then, for the non-HQ location data, use location to set up an array mentioning each entry's info.

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Organization",
  "address": {HQ PostalAddress, etc.},
  "location":[
    {
      "@type": "PostalAddress"
    },
    {
      "@type": "PostalAddress"
    }
  ]
}
</script>

Now, should the headquarters address be included in the location array in addition to being announced separately with the un-nested address? It depends: If the HQ is only a corporate office that doesn't handle usual business traffic like the locations do (think about how the Dominoes home office operates versus all the branch/neighborhood locations) I'd say no, otherwise then yes.

Share:
9,189

Related videos on Youtube

AndyHua
Author by

AndyHua

Enterprise System Professional

Updated on September 18, 2022

Comments

  • AndyHua
    AndyHua over 1 year

    I have a site I am creating for a non-profit organization. Their organization has a United States Mailing Address and a Canada Mailing Address. I want to add both addresses with Schema.org (using JSON-LD), but I cannot figure out how. I originally tried this:

    "address": {
        "@type": "PostalAddress",
        "addressCountry": "United States",
        "addressLocality": "City",
        "addressRegion": "State",
        "postalCode": "12345",
        "postOfficeBoxNumber": "1234"
    },
    "address": {
        "@type": "PostalAddress",
        "addressCountry": "Canada",
        "addressLocality": "City",
        "addressRegion": "Province ",
        "postalCode": "Zip",
        "streetAddress": "Box 123 12345 - 123 Street NW"
    },
    

    When I run a test on this schema it uses only the last address.

    I tried wrapping the addresses using "location": {} but that threw an error.

    How would I add both addresses in the Schema.org markup using JSON-LD?

  • AndyHua
    AndyHua almost 9 years
    I thought it would be something like this but I couldn't figure it out. Thank you for your help, again.
  • Deepak Mathur
    Deepak Mathur over 2 years
    I'm trying to implement the same. This looks helpful. Thank you