When there's 0 likes the data is missing from the JSON but when there's 0 comments it actually displays "0 comments" in the data.
Example Graph API JSON response
{
id:"513086950_10150999823946951",
from:{
name:"Joe Jiko",
id:"513086950"
},
message:"Speaking of the graph api, when there's 0 likes the data is missing from the JSON data but when there's 0 comments it actually displays \"0 comments\" in the data.",
actions:[
{
name:"Comment",
link:"https://www.facebook.com/513086950/posts/10150999823946951"
},
{
name:"Like",
link:"https://www.facebook.com/513086950/posts/10150999823946951"
}
],
privacy:{
description:"Public",
value:"EVERYONE"
},
type:"status",
application:{
name:"JoeJiko.com",
namespace:"joejikocom",
id:"160372647359458"
},
created_time:"2012-08-18T04:05:46+0000",
updated_time:"2012-08-18T04:05:46+0000",
comments:{
count:0
}
}

Why would they do this?
I'm now forced in my application to check if likes are undefined whereas it's unnecessary to do so for comments.

Similar Posts