15

I have a site with a lot of data, and I'm dynamically building JSON-LD data that I think is Schema.org correct. I can't find a dead-on example on Schema.org, and it will take forever if I have to publish the content live, then wait for Google to say there's a problem, then re-attempt it, then wait again, etc.

This is an example of what I'd like to validate:

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "TravelAction",
    "agent": {
        "type": "Person",
        "name": "John Schmuckatelly"
    }
    "fromLocation": {
        "@type": "Country",
        "name": Curacao",
        "@type": "GeoCoordinates",
        "latitude": 12.05",
        "longitude": -68.81667"
    }
    "toLocation": {
        "@type": "Country",
        "name":Aruba
    }
}
</script>
  • You can execute the json locally and then copy and paste the HTML into Google's Webmaster Tools Structured data tool. No direct json method will exist since this isn't not what is displayed in the browser, the output is.. so just setup the json to output completely and then verify it,. – Simon Hayter Dec 30 '13 at 0:35
  • I tried the web master tool using Schema.org's own example (schema.org/TravelAction), pasting the script tag in, and it's not showing any structured data. Regarding "executing the json", the json data is just data sitting in a script tag that google/whomever should be able to read. Not much else I think I need to do with it? – Eric Dec 30 '13 at 0:47
  • Google updated their link to the Structured Data Testing Tool, so try pasting it there. – chharvey Dec 27 '17 at 1:38
8

Tool from Yandex

  • The "Structured data validator" supports JSON-LD.

    Alexander Shubin (working for Yandex) wrote:

    Pls, take into account that in order to check JSON-LD you need to put it in tag (since this is how it should be embedded into html). E.g.,

    <script type="application/ld+json">{
      "@context":"http://schema.org",
      "@type" : "CommunicateAction",
     "instrument" : {
        "@type" : "EmailMessage"
      },
      "handler" : {
        "@type" : "WebHandler",
       "url" : "http://www.example.com/send_email"
      }
    }
    </script>
    

Tools from Google

  • The Yandex tool seemed to work out the best for me, and after an hour of tweaking->copy->paste->retweak I finally got it looking good. Thanks so much for the help. The Google tool seems to only validate certain types (events, local businesses, etc) which in my case can't really do much. – Eric Dec 30 '13 at 15:33
  • @radpin: Google has released a new tool (see update in my answer), maybe this is of interest to you. – unor Jan 17 '15 at 14:46
  • 1
    Google updated their link to the SDTT again: search.google.com/structured-data/testing-tool – chharvey Dec 27 '17 at 1:39
  • If you're using TypeScript, you can integrate some form of Schema.org validation into your dev toolchain with typings like github.com/google/schema-dts – EyasSH Jan 10 at 20:07

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.