Hi,
Use JSON.Net Link :
http://james.newtonking.com/json[
^]
How to desalinize JSON using JSON.Net
string json = @"{
'Name': 'Bad Boys',
'ReleaseDate': '1995-4-7T00:00:00',
'Genres': [
'Action',
'Comedy'
]
}";
Movie m = JsonConvert.DeserializeObject<Movie>(json);
string name = m.Name;
This example you will find at above mentioned link.
but now very careful about culture information in JSON. If you serialize and Deserialize with same application then that's not a problem but if not then provide additional settings.
TestType ObjGraph=new TestType();
string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(ObjGraph,typeof(TestType), new Newtonsoft.Json.JsonSerializerSettings()
{
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Local,
});
TestType Obj = null;
Obj = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonString , typeof(TestType),
new Newtonsoft.Json.JsonSerializerSettings()
{
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Local
});
Enjoy :)