Json data not being displayed

why is that when my json data is with bracket is not being displayed

[{"name":"Steve","state":"CA"}]

this below works just fine

{“name”:“Steve”,“state”:“CA”}

here is my controller

.controller('TestController', function($scope, $http){
    $http.get('http://192.168.10.33/api/data').then(function(resp){
    console.log('Success', resp);
    $scope.name = resp.data.name;
    }, function (err){
    console.error('ERROR',err);
    })
})

i use {{name}} to display on html file the json data

I love JSON because it’s structure is actually almost identical (a little more strict) to Javascript objects!

Your first example has the [ ] around it, which means that it is an ARRAY type. So you have an array, and the index 0 of the array is your object with name and state.

The second example doesn’t have the [ ] which means that it just resembles an object with the properties name, and state.

So if you want to use it with the brackets, the line where you set your name is going to look more like this:

$scope.name = resp.data[0].name;

Hope that helps you out!