Hi I am sending using Jquery in a post a JObject to my Web API but I am having issues using the Newtonsoft.Json library to parse it. I thninking is becase I have something like a Jaosn Array but I am not alet ot get it when I am tryint to cast from JObject to JArray
I am getting the data in the WEB API but i am not able to Parse using the online example.
the is at the end of this post. I need some help parsing that object. Any idea?
My controller look like this:
// POST api/returnvalues/5
public string Post(int id, JObject value)
{
var temp = value;
....
}
and my Jquery to send the information is like this.
function PostAPIRequest(address) {
var jObject = JSON.stringify(FilterValuesArray);
var responseJson = null;
$.ajax({
url: address,
type: 'POST',
dataType: 'json',
data: { JObject: jObject },
success: function (data) {
responseJson = data
ProcessDataResponse(responseJson);
//TODO: REFRESH THE DATA GRID
},
error: function (xhr, ajaxOptions, thrownError) {
//TODO redirect to the error page and send error email there.
alert(xhr.status);
alert(thrownError);
}
})
}
JSON
{
"JObject": "[{\"key\":\"20\",\"value\":\"us\"},{\"key\":\"30\",\"value\":\"mini\"},{\"key\":\"31\",\"value\":\"audi\"},{\"key\":\"21\",\"value\":\"4,5,13,14,15,\"},{\"key\":\"29\",\"value\":\"8,\"},{\"key\":\"32\",\"value\":\"7,\"}]"
}