0

I am trying to deserialize this results from facebook graph.

{
   "http://sverigesradio.se/sida/artikel.aspx?programid=179&artikel=628495": {
      "og_object": {
         "id": "10150171428165638",
         "description": "H\u00e4r \u00e4r h\u00f6jdpunkterna i Sportextra den kommande veckan.",
         "title": "Radiosporten s\u00e4nder: Tider och inneh\u00e5ll - Radiosporten",
         "type": "website",
         "updated_time": "2014-11-25T09:01:43+0000",
         "url": "http://sverigesradio.se/sida/artikel.aspx?programid=179&artikel=628495"
      },
      "share": {
         "comment_count": 0,
         "share_count": 376
      },
      "id": "http://sverigesradio.se/sida/artikel.aspx?programid=179&artikel=628495"
   }
}

My class looks like this:

public class FacebookResponse : ISocialMediaResponse
    {
        [JsonProperty("http://sverigesradio.se/sida/artikel.aspx?programid=179&artikel=628495")]
        public RootObject Root { get; set; }        
    }

It works fine when I am using the url in the JsonProperty, but I dont want to do that.

Here's the url i send to facebook: https://graph.facebook.com/v2.2/?ids=http%3a%2f%2fsverigesradio.se%2fsida%2fartikel.aspx%3fprogramid%3d179%26artikel%3d628495&access_token=xxx

This url will contain several urls, so I can not change the JsonProperty all the time, because the list is dynamically made.

Earlier we used FQL like this link:

[https://graph.facebook.com/fql?q=SELECT+url%2c+total_count%2c+like_count+FROM+link_stat+WHERE+url+IN+(%27http%3a%2f%2fsverigesradio.se%2fsida%2fartikel.aspx%3fprogramid%3d179%26artikel%3d628495%27%2c%27http%3a%2f%2fsverigesradio.se%2fsida%2fartikel.aspx%3fprogramid%3d2078%26artikel%3d723047%27)][1] 

But we are now changing from FQL to use Graph API instead.

n3tx
  • 429
  • 2
  • 10
  • 23
  • possible duplicate of [How can I parse a JSON string that would cause illegal C# identifiers?](http://stackoverflow.com/questions/24536533/how-can-i-parse-a-json-string-that-would-cause-illegal-c-sharp-identifiers) – Brian Rogers Dec 01 '14 at 14:59
  • Thank you! This duplicate solves my problem! Sorry I didn't find it my self. – n3tx Dec 01 '14 at 15:31
  • 2
    No worries; glad you found the link helpful. – Brian Rogers Dec 01 '14 at 15:43

0 Answers0