json - Is it possible to tell Newtonsoft to map a declared $type to a different type when deserialising?
问题描述
I have many serialized objects that have a $type
property that I'd like to deserialize. However, I want to tell Newtonsoft to map to different type depending on the value of $type
,
How can I do this?
E.g.
{
"$type": "A.B.C, A.B",
"MyProp": "MyValue"
}
I'd like Newtonsoft to interpret this as:
{
"$type": "A.B.D, A.B",
"MyProp": "MyValue"
}
解决方案
推荐阅读
- python - 解析大文本文档,只保留“帐号”和特定关键字(“市值”)
- r - 使用 merge() 从其他表中删除第一个表的所有匹配条目
- big-o - log(n!) 如何以 Ω(log(n^n)) 为界
- google-analytics - 我可以使用 google Analytics 动态自定义页面吗?
- sql-server - 根据 csv 文件中列的定义值拆分行
- excel - 如何提取合并的数据并将它们放入不同的工作表中?
- javascript - 参数未传递且导航器在 createStackNavigator 中不可用 - React Navigation
- installation - 在通过 NSIS 创建的安装程序中查看详细信息太慢
- javascript - AG-GRID Excel 导出:AG-Grid 中是否有任何方法可以配置每个用户的记录导出限制?
- usb - HID类和音频类的区别?