Hi,
I am struggling to parse JSON data. I am calling a webmethod to get JSON data in form of string.
here is the sample.
{
"data": [
{
"act": "8.6",
"dt": "01-Feb-2004"
},
{
"act": "4.9",
"dt": "01-Mar-2004"
},
{
"act": "7.3",
"dt": "01-Apr-2004"
},
{
"act": "6.8",
"dt": "01-May-2004"
},
{
"act": "8.1",
"dt": "01-Jun-2004"
}
]
}
This is how I am trying to parse it.
$.ajax({
type: "POST",
url: "testJSON.aspx/getHistory",
data: "{}",
contentType: "application/json",
dataType: 'json',
success: function (data) {
alert('Into the function');
var obj = JSON.parse(data);
}
});
I found
SyntaxError: JSON.parse: unexpected character
error while debugging in firebug. I have checked my JSON on
http://jsonlint.com/[
^] and its seems to be fine.
Anyone can point out mistake. I must doing something silly out here. Please give me the solution.