我張貼JSON對象到一個控制器動作:C#MVC 4 JSON請求
$.ajax({
url: "/path/to/action",
type: "POST",
dataType: "json",
data: {
name: "John Doe",
phone: "2323454543",
skills: {
code: "php",
design: "photoshop"
}
}
});
我怎麼能這個數據映射到某種鍵值對對象的?在PHP中,這些被映射到一個關聯數組無形。我希望能夠像這樣訪問屬性:
SomeDynamicType data = ...//something here to prepare json data
string codeSkills = data.skills.code; //codeSkills should = "php"
我不感興趣的模型綁定,因爲這些值不符合一個模型 - 他們是任意的。
http://stackoverflow.com/questions/6620165/how-to-parse-json-in-c – 2013-03-21 06:19:27