I have Json with item like below:
{
"Id": 3355211,
"TimeStamp": "2018-08-13T00:16:06.47",
}
I want access TimeStamp so I call
string _time= item.TimeStamp;
So _time return {8/13/2018 12:16:06 AM}
. I want get exactly 2018-08-13T00:16:06.47
. How can I do that ?
Below is the sample code and using Newtonsoft.Json
void Main()
{
var s = "{ \"Id\": 3355211, \"TimeStamp\": \"2018-08-13T00:16:06.47\", }";
JsonConvert.DeserializeObject<JsonClass>(s).Dump();
}
public class JsonClass{
public int Id { get; set; }
public string TimeStamp { get; set; }
}
And the output will look like,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.