没有解析JSON数据?

I followed the advice here on how to use JSON.

After using

$resultAml =  json_encode($resultArray);

in PHP I get this at the client:

[{"id":"1","0":"1","title":"Facebook","1":"Facebook","url":"http://facebook.com","2":"http://facebook.com","domain":"facebook.com","3":"facebook.com","tag":"","4":""},{"id":"1","0":"1","title":"Ideeli","1":"Ideeli","url":"http://www.ideeli.com","2":"http://www.ideeli.com","domain":"ideeli.com","3":"ideeli.com","tag":"web","4":"web"},{"id":"1","0":"1","title":"Kikin","1":"Kikin","url":"http://www.kikin.com","2":"http://www.kikin.com","domain":"kikin.com","3":"kikin.com","tag":"web","4":"web"},{"id":"1","0":"1","title":"Lot18","1":"Lot18","url":"http://www.lot18.com","2":"http://www.lot18.com","domain":"lot18.com","3":"lot18.com","tag":"web","4":"web"},{"id":"1","0":"1","title":"Quora","1":"Quora","url":"http://quora.com","2":"http://quora.com","domain":"quora.com","3":"quora.com","tag":"","4":""},{"id":"1","0":"1","title":"Twitter","1":"Twitter","url":"http://twitter.com","2":"http://twitter.com","domain":"twitter.com","3":"twitter.com","tag":"","4":""}] 

That looks like valid JSON according to json.org

Howwever,

When I parse it on the client side using

JSON.parse

I get this result:

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Looks like one [object Object] for each entry in the table.

What is object Object?

Where did I go wrong here? Or if not how do I get to the data in the result?

You have the data, you just misunderstand how it's being displayed. The default string representation of any JavaScript Object, which is what JSON {...} values are, is just [object Object]. If you try to access the properties of the objects you will see that the data you expect is there:

var input = '[{"id":"1","0":"1","title":"Facebook","1":"Facebook","url":"http://facebook.com","2":"http://facebook.com","domain":"facebook.com","3":"facebook.com","tag":"","4":""},{"id":"1","0":"1","title":"Ideeli","1":"Ideeli","url":"http://www.ideeli.com","2":"http://www.ideeli.com","domain":"ideeli.com","3":"ideeli.com","tag":"web","4":"web"},{"id":"1","0":"1","title":"Kikin","1":"Kikin","url":"http://www.kikin.com","2":"http://www.kikin.com","domain":"kikin.com","3":"kikin.com","tag":"web","4":"web"},{"id":"1","0":"1","title":"Lot18","1":"Lot18","url":"http://www.lot18.com","2":"http://www.lot18.com","domain":"lot18.com","3":"lot18.com","tag":"web","4":"web"},{"id":"1","0":"1","title":"Quora","1":"Quora","url":"http://quora.com","2":"http://quora.com","domain":"quora.com","3":"quora.com","tag":"","4":""},{"id":"1","0":"1","title":"Twitter","1":"Twitter","url":"http://twitter.com","2":"http://twitter.com","domain":"twitter.com","3":"twitter.com","tag":"","4":""}]';
var data = JSON.parse(input);
alert(data[0].title); // displays "Facebook"

Everything is correct.

There is no special support for printing object properties; { a: 42 }.toString() returns [object Object].

To see the actual data, call console.log(something).
This will display the actual object structure in the console.

Let's take a look at your json parsed data.

[
 {
  "id":"1",
  "0":"1",
  "title":"Facebook",
  "1":"Facebook",
  "url":"http://facebook.com",
  "2":"http://facebook.com",
  "domain":"facebook.com",
  "3":"facebook.com",
  "tag":"",
  "4":""
},
{
  "id":"1",
  "0":"1",
  "title":"Ideeli",
  "1":"Ideeli",
  "url":"http://www.ideeli.com",
  "2":"http://www.ideeli.com",
  "domain":"ideeli.com",
  "3":"ideeli.com",
  "tag":"web",
  "4":"web"
},
{
  "id":"1",
  "0":"1",
  "title":"Kikin",
  "1":"Kikin",
  "url":"http://www.kikin.com",
  "2":"http://www.kikin.com",
  "domain":"kikin.com",
  "3":"kikin.com",
  "tag":"web",
  "4":"web"
},
{
  "id":"1",
  "0":"1",
  "title":"Lot18",
  "1":"Lot18",
  "url":"http://www.lot18.com",
  "2":"http://www.lot18.com",
  "domain":"lot18.com",
  "3":"lot18.com",
  "tag":"web",
  "4":"web"
},
{
  "id":"1",
  "0":"1",
  "title":"Quora",
  "1":"Quora",
  "url":"http://quora.com",
  "2":"http://quora.com",
  "domain":"quora.com",
  "3":"quora.com",
  "tag":"",
  "4":""
},
{
  "id":"1",
  "0":"1",
  "title":"Twitter",
  "1":"Twitter",
  "url":"http://twitter.com",
  "2":"http://twitter.com",
  "domain":"twitter.com",
  "3":"twitter.com",
  "tag":"",
  "4":""
}
]

It seems that you have a lot of objects in your data. An OBJECT is a collection of data with properties. Your object has the following properties:

id, 0, title, 1, url, 2, domain, 3, tag, 4

If you compare with the PHP patterns, this is like a multidimensional array. Both for java and PHP if you want to process all entries you have to iterate over your data object. You can do it by using jQuery "each()" function.

var data = 'yourJSONoutput';    
 $.each(data, function() {
     alert(this.title);
 });

This will alert the titles for all objects inside your json data.