Convert JSON String To C# Object

Jacob
Jacob
104 Points
14 Posts

Hi,

How to convert JSON String To C# Object?

I have json string as:

{
 "email": "niceonecode@gmail.com",
 "iat": "1440924301",
 "exp": "1440927901",
 "name": "Nice One Code",
 "given_name": "Nice One",
 "family_name": "Code",
 "locale": "en"
}

I want to de-serialize to c# object.

Views: 9933
Total Answered: 1
Total Marked As Answer: 0
Posted On: 30-Aug-2015 01:47

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
4916 Points
27 Posts
         

Hi Jacob,

Use JavaScriptSerializer to deserialize the json string.

JavaScriptSerializer ScriptSerializer = new JavaScriptSerializer();
 
dynamic JsonObject = ScriptSerializer.Deserialize<dynamic>(JsonString);
 
string _Email;
 
_Email =JsonObject["email"];

Where JsonString is json string object

Posted On: 05-Sep-2015 02:11
 Log In to Chat