how to deserialize the below Rest response to JSON response my rest response is in the format
{
"new_token":"fdffdsfdsfdsf",
"expires_in":400,
"login_type":"abc"
}
I have a POCO class as
public string NewToken { get; set; }
public string ExpiresIn { get; set; }
public string LoginType { get; set; }
How to store the rest response into the POCO classs
You just need to deserialise the JSON into your class.
Assuming your class is called
Foo, just use theJavaScriptSerializerobject:You will need to add a reference to
System.Web.Extensionsin order to access theJavaScriptSerializer.EDIT
Following additional clarification regarding the mapping of the raw JSON property names to nice-looking .Net names, and assuming your class is called
POCO, I suggest using theDataContractJsonSerializeras follows: