简体   繁体   中英

ld+json formatting error formatting

I'm trying to write code for google structured data but there's an error on line 13 ], at the end of sameAs

Here's the json

<script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Organization",
      "url": "http://www.kenyabuzz.com",
      "logo": "http://www.kenyabuzz.com/media/cache/0f/93/0f9352f94002226ad2e57fdf4cda378a.jpg",

      "sameAs" : [
        "https://www.facebook.com/KenyaBuzz",
        "https://twitter.com/KenyaBuzz",
        "http://instagram.com/kenyabuzz_",
        "http://blog.kenyabuzz.com/",
      ],

      "contactPoint" : [{
        "@type" : "ContactPoint",
        "telephone" : "+254773809556",
        "contactType" : "customer service",
        "areaServed" : "KE"
      }]

    }


</script>

It's for google structure data and can be tested here https://developers.google.com/structured-data/testing-tool/

Just remove the , from line number 12.

<script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Organization",
      "url": "http://www.kenyabuzz.com",
      "logo": "http://www.kenyabuzz.com/media/cache/0f/93/0f9352f94002226ad2e57fdf4cda378a.jpg",

      "sameAs" : [
        "https://www.facebook.com/KenyaBuzz",
        "https://twitter.com/KenyaBuzz",
        "http://instagram.com/kenyabuzz_",
        "http://blog.kenyabuzz.com/"
      ],

      "contactPoint" : [{
        "@type" : "ContactPoint",
        "telephone" : "+254773809556",
        "contactType" : "customer service",
        "areaServed" : "KE"
      }]

    }


</script>

You should try online parsers like http://json.parser.online.fr/ , which gives:

SyntaxError: JSON.parse: unexpected character at line 12 column 7 of the JSON data

then you immediately see the comma pointed out in preceding answers ;-)

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