This project has moved and is read-only. For the latest updates, please go here.

In DeserializeXNode, Utc datetime Convert in Local Time

Nov 13, 2014 at 10:14 AM
Edited Nov 13, 2014 at 10:16 AM
I received json from another service provider, Service provider given "createDate" as a json attribute which contain "UTC" date-time format of that country where file was created, when i de-serialize json data using "JsonConvert.DeserializeXNode" i get wrong data-time. I am giving some example of these problem.

Code :
string jsonData = @"{ '@Id': 1, 'Email': '', 'Active': true, 'CreatedDate': '2013-01-20T23:50:00+05:30', 'Roles': ['User', 'Admin' ], 'Team': {'@Id': 2, 'Name': 'Software Developers', 'Description': 'Creators of fine software products and services.' }}";

XNode objXNode = JsonConvert.DeserializeXNode(jsonData, "Root");

OutPut is:

<Root Id="1"> <Email></Email> <Active>true</Active> <CreatedDate>2013-01-20T18:20:00+00:00</CreatedDate> <Roles>User</Roles> <Roles>Admin</Roles> <Team Id="2"> <Name>Software Developers</Name> <Description>Creators of fine software products and services.</Description> </Team>

Please Resolve this problem.