我有一個asp.net mvc api控制器方法,它有一個List作爲其返回方法。當把它稱爲返回此JSON數據:asp.net mvc api json wrapper
[
{
"AreaName": null,
"AreaId": 0,
"DestinationName": "Alanya",
"DestinationId": 14,
"CountryName": "Tyrkiet",
"CountryId": 15
},
{
"AreaName": null,
"AreaId": 0,
"DestinationName": "Antalya",
"DestinationId": 113,
"CountryName": "Tyrkiet",
"CountryId": 15
}
]
早些時候,當我在一個asp.net MVC過這種方法,它可能會類似於此:
較早JSON數據:
{
"ContentEncoding":{
"IsSingleByte":true,
"BodyName":"iso-8859-1",
"EncodingName":"Western European (Windows)",
"HeaderName":"Windows-1252",
"WebName":"Windows- 1252",
"WindowsCodePage":1252,
"IsBrowserDisplay":true,
"IsBrowserSave":true,
"IsMailNewsDisplay":true,
"IsMailNewsSave":true,
"EncoderFallback":{
"MaxCharCount":1
},
"DecoderFallback":{
"MaxCharCount":1
},
"IsReadOnly":true,
"CodePage":1252
},
"ContentType":"application/json;",
"Data":
和那麼上面的列表將被添加到數據包裝裏面
我的問題是 - 如何在使用asp.net mvc web api時返回此「包裝」格式?
只是好奇回 對象是一個有效的JSON已經? – 2013-05-01 10:48:18