google Structured Data Testing Tool error

- 1 answer

Ad
<script type="application/ld+json">
{"@context" : "http://schema.org",
  "@type" : "LocalBusiness",
  "name" : "website.com",
  "description": "About. asdadsad ",
  "image" : "http://website.com/image.png",
  "telephone" : "123456789",
  "email" : "[email protected]",
  "address" : {
      "@type" : "PostalAddress",
      "streetAddress" : "N1 Big street",
      "addressLocality" : "city",
      "addressCountry" : "Country"
},
  "url" : "http://somesite.com/",
   "sameAs" : ["http://www.facebook.com/",
   "http://twitter.com",
   "http://plus.google.com/"],
   "aggregateRating" : {
       "@type" : "AggregateRating",
       "ratingValue" : "4",
       "bestRating" : "5",
       "worstRating" : "0"
},
</script>

This is my created code for web schema, but when I try to test on Google Structured Data Testing Tool it returns the error :

JSON-LD: There was an error parsing your JSON-LD.

How do I fix this? Which error do I have in this code ?

Ad

Answer

Ad

Your JSON is missing a closing bracket } at the end.

Your last } is closing the aggregateRating propriety and you have none to close your object.

Just add a } and it works.

PS : your AggregateRating object is missing a ratingCount or reviewCount.

Here is an fixed version of your code:

<script type="application/ld+json">
{
  "@context" : "http://schema.org",
  "@type" : "LocalBusiness",
  "name" : "website.com",
  "description": "About. asdadsad ",
  "image" : "http://website.com/image.png",
  "telephone" : "123456789",
  "email" : "[email protected]",
  "address" : {
    "@type" : "PostalAddress",
    "streetAddress" : "N1 Big street",
    "addressLocality" : "city",
    "addressCountry" : "Country"
  },
  "url" : "http://somesite.com/",
  "sameAs" : [
    "http://www.facebook.com/",
    "http://twitter.com",
    "http://plus.google.com/"
  ],
  "aggregateRating" : {
    "@type" : "AggregateRating",
    "ratingValue" : 4,
    "bestRating" : 5,
    "worstRating" : 0,
    "ratingCount" : 12
  }
}
</script>
Ad
source: stackoverflow.com
Ad