我将得到如下格式的 JSON 对象,每种格式都包含不同的属性/键,即这些属性/键是动态的。
var SelectedRows= [
{"id":"1","name":"jhon","phone":"6699"},
{"id":"2","name":"Aron","phone":"7799"},
{"id":"3","name":"Iyan","phone":"8899"},
]
var SelectedRows= [
{"id":"1","fname":"jhon","lname":"6699"},
{"id":"2","fname":"Aron","lname":"7799"},
{"id":"3","fname":"Iyan","lname":"8899"},
]
var SelectedRows= [
{"id":"1","fname":"jhon","lname":"6699"},
{"id":"2","fname":"Aron","lname":"7799"},
{"id":"3","fname":"Iyan","lname":"8899"},
]
使用 AJAX post call 发布数据。
$.ajax({
url: "@Url.Action("Export", "Export")",
type: "POST",
data: JSON.stringify(SelectedRows),
success: function(result) {}
});
控制器动作方法:
[HttpPost]
public ActionResult Export(**what type to specify here**)
{
}
正如我所说的属性/键是动态的,所以我不能在这里使用强类型模型。我必须为操作方法指定一些通用类型的参数。
我不知道这可能吗?如果是,怎么办?