This project is read-only.

Cannot convert invalid JSON String to Json Object

May 13, 2011 at 4:37 PM

Hi, Kayson,

I'm working to get the comments from a certain post, what I did is this:

Facebook_Graph_Toolkit.GraphApi.Post post = new Facebook_Graph_Toolkit.GraphApi.Post(PostID, Api.AccessToken);

IList<Facebook_Graph_Toolkit.GraphApi.Comment> comments = post.comments;

but the error comes from the first line of code. I checked that the PostID and AccessToken are all valid. what could have went wrong?

May 13, 2011 at 5:44 PM

The library cannot convert the string given by Facebook into a JsonObject. Either the string is in an incorrect format, or there's some special case which the library cannot handle.

If you would like to, you can email me the PostID and AccessToken so I can take a look at what exactly went wrong. Don't post your AccessToken here.

May 14, 2011 at 12:35 PM

Hi, Kayson, thanks for the reply through email regarding the error, however, I am still not quite sure where I did wrong, because that postID is what I get thorugh:

string PostID = Api.PostFeed("...");

so I ran the program again and immediate after the post, I checked on FB, and it's there, so I grab the PostID that's just stored in DB and went to this link:

and it gives me "false"

I'm wondering if I did anything wrong or is there a step that I missed. thanks!

May 14, 2011 at 1:12 PM

I understand that it needs to retrieve the post with access token, but from what you said, if the post object doesn't exist, then why would it appear in FB on my wall? thanks for clearing this for me, much appreciated =)

May 15, 2011 at 7:27 PM

It looks like this is a bug with Facebook in your case.

May 16, 2011 at 3:30 AM

have been working on this the whole weekend, and finally figured out something:

in order to get the post, the permission "read_stream" has to be allowed, instead of just "publish_stream"

however, Kayson, I discovered another thing that you might be interested in.

I did a post through Api.PostComment("...") method, and indeed it posted to my wall (I checked on facebook right after I post), but when I use:

Facebook_Graph_Toolkit.GraphApi.Post post = new Facebook_Graph_Toolkit.GraphApi.Post("<post_ID>", Api.AccessToken);
IList<Facebook_Graph_Toolkit.GraphApi.Comment> comments = post.comments;

the comments will not show the latest comments that I just post. I thought that I didn't post it right, so I went and check against this:<post_id>/comments?access_token=<token>

and it does display the latest comments.

it seems like Post.Comments does not display the latest comments, perhaps it's an session issue? because 5 minutes later after I close the object and run the code again, the latest comments did show up.