[英]How do I deserialize TimeOnly (c#) from json?
I am currently doing the following:我目前正在执行以下操作:
var json = JsonConvert.SerializeObject(product);
return JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
The object product
has objects of type TimeOnly
. object
product
具有TimeOnly
类型的对象。 The serialize part works but the deserialize causes it to crash.序列化部分可以工作,但反序列化会导致它崩溃。 Any ideas?
有任何想法吗?
Thanks in advance.提前致谢。
https://github.com/JamesNK/Newtonsoft.Json/issues/2521 https://github.com/JamesNK/Newtonsoft.Json/issues/2521
Supported in 13.0.2 betas.在 13.0.2 测试版中受支持。
System.Text.Json
supports it. System.Text.Json
支持它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.