I get a JSON response from a third-party API through Javascript, which I send AJAX to the server. Here I am trying to convert this to an object. I saw a simple example of this online using a custom class, but the problem in my case is that the number of fields can change. In one case, they can be simple: UserName: Blah, Age: Blah ... In another case, it can be: UserName: Blah, Age: Blah, Favorite game: Blah.
What is the best solution here?
Thanks for any input.
PS: I try to use this code below, but I get an error: Friends do not support array deserialization.
public class Friends { public IList<IDictionary<string,string>>data {get;set;} } protected void UpdateTrigger_Click(object sender, EventArgs e) { Friends fbFriends = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<Friends>(Hidden1.Value); }
source share