Saravana Kumar Saravana Kumar - 4 months ago 28
AngularJS Question

How to remove parentheses from JSON in start and end?

I have a Json Object look like ,

({
"result":[{
"key":"value".....
}]
})


I don't know how to remove the parentheses from the starting and ending of the JSON like
(
and
)
. Please guide me.

Answer

My guess is that you are trying to access JSONP data. You probably need to add ?callback=? to your URL

var url="http://www.somedata.com";
    $.getJSON(url+'?callback=?', function(json){
        //loop through deals
        $.each(json.people,function(i,dat){
            $("#todaycal").append("<li>"+dat.name+"  "+dat.caseNo+"</li>");
        });
        $("#todaycal").listview('refresh');
    });