Json.Net parsing datetime value error
I am trying to convert a json string to a JObject using JObject.Parse, but running into the error "Error parsing positive infinity value. Path 'Modified.Date', line 1, position 52."
Here is the part of json that is throwing the error on -
{ ..., "Modified" : { "Date" : ISODate("2013-02-21T22:23:57.118Z"), "User" : "Admin" }, ...}
Here is the code I am using to do the parse -
var jobj = JObject.Parse(formJson)
Update: The json was generated by using mongodb's .ToJson() extension method, by sending in the following jsonwritersettings it generated json that was parsable by json.net - new JsonWriterSettings { OutputMode = JsonOutputMode.JavaScript };
I think you need to lose the ISODate.
This works:
String MyJson = "{MyDate : "2013-02-21T22:23:57.118Z" }";
var x = Newtonsoft.Json.Linq.JObject.Parse(MyJson);
链接地址: http://www.djcxy.com/p/20080.html
上一篇: 使用JSON.NET将动态JSON字符串解析为C#中的字符串
下一篇: Json.Net解析日期时间值错误