简体   繁体   中英

google Structured Data Testing Tool error

<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" : "mail@com",
  "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 ?

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" : "mail@com",
  "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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM