我正在使用Web Api和Ember JS,所有工作都很好,直到我開始使用Ember Data,它似乎需要包含在json中的對象名稱。WEB API JSON結果與對象名稱
我該如何添加?
目前越來越:
[
{
"id": 1,
"title": "maxima",
"subTitle": null,
"description": "Maxima de boot",
"image1": null,
"image2": null,
"active": false,
"skipper": null
},
{
"id": 2,
"title": "beatrix",
"subTitle": null,
"description": "Beatrix de boot",
"image1": null,
"image2": null,
"active": false,
"skipper": null
}
]
非常感謝!
嗨馬丁,謝謝你的回覆!是的,我知道,問題是web api默認行爲輸出上面的json沒有對象名稱,我想知道如何將web api中的輸出更改爲正確的格式。 – mausinc
您可以通過以下網址提供的解決方案來解決此問題:http://www.emadibrahim.com/2014/04/09/emberjs-and-asp-net-web-api-and-json-serialization/然而,是另一個問題,因爲此解決方案適用於GET,對於其他VERB,您將在服務器端收到空值。 – codebased