I'm goofing around with the Star Wars API but don't get why I can't parse the data I get back:
<script>
$.ajax({
url: "http://swapi.co/api/people/1/"
}).done(function( data ) {
console.log(JSON.stringify({'foo': 'bar'})) //returns {"foo":"bar"}
console.log(JSON.parse(JSON.stringify({'foo': 'bar'}))) //returns Object {foo: "bar"}
console.log(data); //returns Object {name: "Luke Skywalker", height: "172", mass: "77", hair_color: "blond", skin_color: "fair"…}
console.log(JSON.parse(data)) // throws error VM747:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1
});
</script>