Search code examples
schema.orgjson-ld

Error in SDTT for an array of hasOccupation objects using Roles: "hasOccupation is not a known valid target type for the hasOccupation property"


Using JSON-LD syntax and the Schema.org vocab, per Schema.org's Occupation example 4, the following should be valid, but it is not.

{
    "@context": "http://schema.org",
    "@type": "Person",
    "name": "Jane Smith",
    "sameAs": "http://en.wikipedia.org/wiki/Jane_Smith",
    "worksFor": {
        "@type": "Organization",
        "name": "McKinsey & Company",
        "url" : "http://www.mckinsey.com"
    },
    "hasOccupation": [ {
          "@type": "Role",
          "hasOccupation": {
            "name": "Management Consultant"
          },
          "startDate": "2016-04-21"
        }, {
          "@type": "Role",
          "hasOccupation": {
            "name": "Chief Strategic Officer"
          },
          "startDate": "2013-11-14",
          "endDate": "2016-03-22"
        }, {
          "@type": "Role",
          "hasOccupation": {
            "name": "Vice President of Sales"
          },
          "startDate": "2009-09-20",
          "endDate": "2013-10-14"
        }
    ]
}

Via Google's Structured Data Testing Tool:

hasOccupation is not a known valid target type for the hasOccupation property.


Solution

  • You are not providing the type of the hasOccupation value inside the Role. It expects an Occupation value.

    So this

    "hasOccupation": {
      "name": "Management Consultant"
    }
    

    should becomes this

    "hasOccupation": {
      "@type": "Occupation",
      "name": "Management Consultant"
    }
    

    (Same for the other occurrences.)