I am working with an crossdomain api that returns a jsonp string. I want to parse it into a javascript object so that it gets easier to work with. I know that with a json string you can just do this:
success: function (val) {
var result = JSON.parse(val);
}
But if i do that with the jsonp i got from the api i get "Uncaught SyntaxError: Unexpected token o"
Am i doing it wrong or is this not the way to do it with jsonp?
--------EDIT 1--------------------------- This is what my jsonp string looks like if i open it up:
Object {resource: "boxscore", parameters: Object, resultSets: Array[22]}
parameters: Object
resource: "boxscore"
resultSets: Array[22]
0: Object
1: Object
2: Object
3: Object
4: Object
headers: Array[28]
0: "GAME_ID"
1: "TEAM_ID"
2: "TEAM_ABBREVIATION"
3: "TEAM_CITY"
4: "PLAYER_ID"
5: "PLAYER_NAME"
6: "START_POSITION"
7: "COMMENT"
length: 28
__proto__: Array[0]
name: "PlayerStats"
rowSet: Array[26]
0: Array[28]
0: "0041300201"
1: 1610612764
2: "WAS"
3: "Washington"
4: 2772
5: "Trevor Ariza"
6: "F"
7: ""
8: "37:20"
9: 7
10: 10
11: 0.7
12: 6
1: Array[28]
2: Array[28]
3: Array[28]
4: Array[28]
5: Array[28]
6: Array[28]
So what i want to do is parse the data with the header-info in each array, how do i do that? So for example if i want GAME_ID i just write GAME_ID and i get the gameid "0041300201" for each array.