1
我的问题类似于WCF Data Services: How to avoid the __metadata members。从WCF数据服务中删除__metadata
我想将以下Json映射到模型类。
{
"d" : [
{
"__metadata": {
"uri": "http://172.xx.x.xxx:81/NotificationDataService.svc/Notifications(1)", "type": "MyModel.Notification"
}, "Id": 1, "Message": "This is a test notification"
}
]
}
但是有了这个__metadata成员,我被卡住了。无论如何,我可以删除这个?或者任何人都可以帮助我如何将这个JSON映射到模型类?
Tx。
如果您能够使用新的v3 OData JSON格式,那将更容易处理。在这种格式下,如果您只需要原始数据并且不需要元数据,则可以在Accept头中请求“application/json; odata = nometadata”。如果您所说的服务器支持v3 JSON,这只是一个解决方案。 –
谢谢你的回答:) – Manoj