PositiveGuy
PositiveGuy

Reputation: 20212

Trouble with JSON Array Form

I can't figure out why this is not valid JSON after testing it with jsonlint.com. It's just an array of objects and I don't see anything missing or out of place.

[
    {
        “rel”: “self”,
        "href": "http://ourdomain/persons",
        "name": {
            "last": "best"
        }
    },
    {
        “rel”: “self”,
        "href": "http://ourdomain/persons",
        "name": {
            "last": "bet"
        }
    },
    {
        “rel”: “self”,
        "href": "http://ourdomain/persons",
        "name": {
            "last": "brown"
        }
    }
]

Upvotes: 1

Views: 27

Answers (2)

Syed Danish Ali
Syed Danish Ali

Reputation: 391

Look at the quotation marks wrapping rel and self.

[
{
    "rel": "self",
    "href": "http://ourdomain/persons",
    "name": {
        "last": "best"
    }
},
{
    "rel": "self",
    "href": "http://ourdomain/persons",
    "name": {
        "last": "bet"
    }
},
{
    "rel": "self",
    "href": "http://ourdomain/persons",
    "name": {
        "last": "brown"
    }
}

]

DONE!

Upvotes: 2

Alexis Tyler
Alexis Tyler

Reputation: 959

The problem you've got is the quotes are being replaced with another HTML character.

If you look here “rel”: “self”, you'll noticed that it's using and not ". Replace them and you should be fine.

Upvotes: 1

Related Questions