GSON Not an Object Error
I have the following json object:
cNGJSON = {
"one": graph1.graphNode, "two": graph2.graphNode, "three":
graph3.graphNode, "four": graph4.graphNode, "five":
graph5.graphNode,"six": graph6.graphNode,
"seven": graph7.graphNode,"eight": graph8.graphNode, "nine":
graph9.graphNode,"ten": graph10.graphNode, "eleven":
graph11.graphNode, "twelve": graph12.graphNode,
"thirteen": graph13.graphNode,"fourteen":
graph14.graphNode,"fifteen": graph15.graphNode,"sixteen":
graph16.graphNode, "seventeen": graph17.graphNode, "eighteen":
graph18.graphNode,
"nineteen": graph19.graphNode
};
where graph1.graphNode is an integer array.
[1,2,3,4]
I send this to the server with jQuery:
$.ajax({
url: 'validate',
type: 'post',
dataType: 'json',
success: function (data) {
console.log("Success!!");
},
data: cNGJSON
});
However I get a
Expected BEGIN_OBJECT but was STRING at line 1 column 1
Error every time I try.
I tried with setting the cNGJSON to:
cNGJSON = {
"one": "Number one", "two": "Number two"
};
Still I get the same error.
No comments:
Post a Comment