I Love Stackoverflow
I Love Stackoverflow

Reputation: 6868

Getting errors and warnings with json data

Below is my Json data that I am trying to represent using Json-LD :

var schemaOrg = angular.toJson({
        "@context": "http://schema.org",
        "@type": "RealEstateAgent",
        "RealEstateAgent": {
                "@type": "RealEstateAgent",
                "address": "123, Xyz Tower, ajkshjask", 
                "areaServed": "Chicago",
                "brand": "My Brand",
                "email": "[email protected]", 
                "knowsLanguage": "English",
                "legalName": "Jerry Kon", 
                "image": "http:samplepic.com",
                "description": "I am great",
                "name": "Jerry Kon",
                "url": "http:myprofilepic.com",
                "Telephone": "1234567899"
            }
    });

This is how I am rendering it:

<script type="application/ld+json" id="json-ld-music-group"></script>

angular.element(document).ready(function () {
                        var jsonLd = angular.element(document.getElementById('json-ld-music-group'))[0];
                        console.log(jsonLd);
                        jsonLd.innerHTML = schemaOrg;
                        console.log(jsonLd.innerHTML);
                    });

Now when I copy paste entire HTML and trying to test in Google Structured Data Testing tool, then this is what I am getting:

enter image description here

But I am getting warning and error which I dont understand why. I already have name and image property in my data and its showing error on that. Also I have address, telephone and its still showing warning on that.

Can someone please help me to solve this problem?

Upvotes: 0

Views: 295

Answers (1)

Tony McCreath
Tony McCreath

Reputation: 3399

You have a RealEstateAgent inside a RealEstateAgent which is not valid. Flatten it down to the one and it is fine:


    {
      "@context": "http://schema.org",
      "@type": "RealEstateAgent",
      "address": "123, Xyz Tower, ajkshjask", 
      "areaServed": "Chicago",
      "brand": "My Brand",
      "email": "[email protected]", 
      "knowsLanguage": "English",
      "legalName": "Jerry Kon", 
      "image": "http:samplepic.com",
      "description": "I am great",
      "name": "Jerry Kon",
      "url": "http:myprofilepic.com",
      "Telephone": "1234567899"            
    }

Upvotes: 2

Related Questions