I'm going round in circles with this, so I hope someone can help me.
I've got the following code:
Dim objResponse As JsonObject
objResponse = CType(JsonConvert.Import(json), JsonObject)
Dim statuses As IDictionary = objResponse
Dim sb As StringBuilder = New StringBuilder
For Each status In statuses("data")
sb.Append(status("message") & "<br />")
sb.Append(status("likes")("data")("id"))
Next
Douglas26
Member
52 Points
44 Posts
"Input string was not in a correct format" error - Json related
Apr 09, 2012 10:36 PM|LINK
Hello,
I'm going round in circles with this, so I hope someone can help me.
I've got the following code:
Dim objResponse As JsonObject objResponse = CType(JsonConvert.Import(json), JsonObject) Dim statuses As IDictionary = objResponse Dim sb As StringBuilder = New StringBuilder For Each status In statuses("data") sb.Append(status("message") & "<br />") sb.Append(status("likes")("data")("id")) Nextbut I get the error on this line:
sb.Append(status("likes")("data")("id"))Hope someone can help with this.
Thank you
Douglas
agavejoe
Member
152 Points
31 Posts
Re: "Input string was not in a correct format" error - Json related
Apr 09, 2012 11:04 PM|LINK
sb.Append(status("likes")("data")("id"))Should be?
sb.Append(status("likes")) sb.Append(status("data")) sb.Append(status("id"))Prashant Kum...
Star
12356 Points
1998 Posts
Re: "Input string was not in a correct format" error - Json related
Apr 09, 2012 11:08 PM|LINK
What are you trying to achieve with this line - sb.Append(status("likes")("data")("id")) ?
What is status?
Douglas26
Member
52 Points
44 Posts
Re: "Input string was not in a correct format" error - Json related
Apr 09, 2012 11:27 PM|LINK
Maybe I should show the relevant JSON
{ "data": [ { "id": "10150658507188596", "from": { "name": "Douglas McGregor", "id": "508898595" }, "message": "Hope everyone is having a good Easter!", "updated_time": "2012-04-08T14:32:58+0000", "likes": { "data": [ { "id": "711736600", "name": "Jen Wilson Conteh" }, { "id": "1489297132", "name": "Kara Lamont" }, { "id": "507143268", "name": "Stephanie Appleton" } ], "paging": { "next": "https://graph.facebook.com/10150658507188596/likes?method=GET&metadata=true&format=json&callback=___GraphExplorerAsyncCallback___&access_token=AAACEdEose0cBAPS9JkiLZCm2onnEiE3Cc3tFuTX5lqBk3NlhxANwltxicPQVGBkh1Q1vVa5Tsti7FigYqD2gMycPR1HuNzTT5BWbVuwZDZD&limit=25&offset=25&__after_id=507143268" } } },etc.
I'm getting JSON data from the Facebook Graph API.