1 回答
TA贡献1797条经验 获得超6个赞
Changed the Web-API function to receive JObject and then extracted my Complex objects from it. Web-API functions looks as below:
public Int64 objectPOC(JObject jsonWrapper)
{
dynamic jsonValues = jsonWrapper;
JArray jsonInput = jsonValues.input;
JArray jsonInput2 = jsonValues.input2;
List<TMS_STATUS> _Status = jsonInput.ToObject<List<TMS_STATUS>>();
List<TMS_STATUS> _Status2 = jsonInput2.ToObject<List<TMS_STATUS>>();
Int64 retValu = 0;
for (int i = 0; i < _Status.Count; i++)
{
retValu++;
}
return retValu;
}
Ajax Call is as follows:
function Call_Service () {
var input =
{
STATUS: "MY New Status",
CATEGORY: "My Value"
};
var input2 =
{
STATUS: "MY New Status2",
CATEGORY: "My Value2"
};
var input_array = new Array();
input_array[0] = input;
input_array[1] = input2;
alert(input_array[0].STATUS);
$.ajax({
type: "POST",
- 1 回答
- 0 关注
- 1942 浏览
添加回答
举报