jjzjj

DeserializeObject

全部标签

c# - JSON.NET DeserializeObject 到对象列表

我正在尝试使用JSON.NET库将对象反序列化为对象列表。我的json文件是:[{"id":1,"name":"Poczta","description":"Opis","latitude":52.25197,"longitude":20.896355,"accuracy":0,"type":"","image":null},{"id":2,"name":"WAT","description":"Budynekgłówny-sztab.\r\nzażółćgęśląjaźń","latitude":52.2531213,"longitude":20.8995849,"accuracy"

c# - JSON.NET DeserializeObject 到对象列表

我正在尝试使用JSON.NET库将对象反序列化为对象列表。我的json文件是:[{"id":1,"name":"Poczta","description":"Opis","latitude":52.25197,"longitude":20.896355,"accuracy":0,"type":"","image":null},{"id":2,"name":"WAT","description":"Budynekgłówny-sztab.\r\nzażółćgęśląjaźń","latitude":52.2531213,"longitude":20.8995849,"accuracy"

c# - 为什么 Json.NET DeserializeObject 将时区更改为本地时间?

我正在使用json.net反序列化DateTimeOffset,但它会忽略指定的时区并将日期时间转换为本地偏移量。例如,给定varcontent=@"{""startDateTime"":""2012-07-19T14:30:00+09:30""}";反序列化时使用:varjsonSerializerSettings=newJsonSerializerSettings(){DateFormatHandling=DateFormatHandling.IsoDateFormat,DateParseHandling=DateParseHandling.DateTimeOffset,DateT

c# - 为什么 Json.NET DeserializeObject 将时区更改为本地时间?

我正在使用json.net反序列化DateTimeOffset,但它会忽略指定的时区并将日期时间转换为本地偏移量。例如,给定varcontent=@"{""startDateTime"":""2012-07-19T14:30:00+09:30""}";反序列化时使用:varjsonSerializerSettings=newJsonSerializerSettings(){DateFormatHandling=DateFormatHandling.IsoDateFormat,DateParseHandling=DateParseHandling.DateTimeOffset,DateT

c# - JObject.Parse 与 JsonConvert.DeserializeObject

JsonConvert.DeserializeObject和JObject.Parse有什么区别?据我所知,两者都带有一个字符串并且都在Json.NET库中。什么样的情况会让一个比另一个更方便,还是主要只是偏好?作为引用,这是我使用两者来做完全相同的事情的示例-解析Json字符串并返回一个Json属性的列表。publicActionResultReadJson(){stringcountiesJson="{'Everything':[{'county_name':null,'description':null,'feat_class':'Civil','feature_id':'368

c# - 使用 JsonConvert.DeserializeObject 将 Json 反序列化为 C# POCO 类

这是我的简单UserPOCO类://////TheUserclassrepresentsaCoderwallUser.///publicclassUser{//////AUser'susername.eg:"sergiotapia,mrkibbles,matumbo"///publicstringUsername{get;set;}//////AUser'sname.eg:"SergioTapia,JohnCosack,LucyMcMillan"///publicstringName{get;set;}//////AUser'slocation.eh:"Bolivia,USA,Fran

c# - 使用非美国日期格式时,JsonConvert.DeserializeObject 无法将字符串转换为 DateTime

我有以下序列化的json对象:"{\"LineItems\":[{\"LineID\":1,\"QuoteID\":\"00000000-0000-0000-0000-000000000000\",\"Quantity\":\"1\",\"UnitPriceExTax\":\"2\",\"UnitPriceTaxRate\":\"2\",\"UnitPriceTaxAmt\":0,\"LineTotalExTax\":2,\"LineTotalTaxAmt\":0.040000000000000036,\"LineTotalIncTax\":2.04}],\"QuoteID\":[],

c# - 使用非美国日期格式时,JsonConvert.DeserializeObject 无法将字符串转换为 DateTime

我有以下序列化的json对象:"{\"LineItems\":[{\"LineID\":1,\"QuoteID\":\"00000000-0000-0000-0000-000000000000\",\"Quantity\":\"1\",\"UnitPriceExTax\":\"2\",\"UnitPriceTaxRate\":\"2\",\"UnitPriceTaxAmt\":0,\"LineTotalExTax\":2,\"LineTotalTaxAmt\":0.040000000000000036,\"LineTotalIncTax\":2.04}],\"QuoteID\":[],