Convert JSON String To C# Object

Jacob
Jacob
34 Points
17 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: 8215
Total Answered: 1
Total Marked As Answer: 0
Posted On: 30-Aug-2015 01:47

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Moderator
1172 Points
211 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