json - getJSON with [ ] doesn't work -


i'm not experienced in stuff, call api wich returns me this

[    {       "beatmapset_id":"18860",       "beatmap_id":"66609",       "approved":"2",       "approved_date":"2010-08-15 10:04:19",       "last_update":"2010-08-15 10:00:44",       "total_length":"468",       "hit_length":"447",       "version":"legend",       "artist":"dragonforce",       "title":"revolution deathsquad",       "creator":"lesjuh",       "bpm":"250",       "source":"",       "difficultyrating":"3.95095",       "mode":"0"    } ] 

my html :

$(document).ready(function(){      $.getjson('whatever.html', function(fbresults) {  document.write(fbresults.beatmapset_id);       });  });  

now problem is, doesn't work way, works if remove "[" , "]" json code.

well, can't tell guy made api remove those, do?

edit: there problem now. https://osu.ppy.sh/api/get_beatmaps?k=5051a27169de8f360636fb0c3a108e8a3dab24b2&b&b=66609 if take link, doesn't work. tried callback doens't work either. https://osu.ppy.sh/api/get_beatmaps?k=5051a27169de8f360636fb0c3a108e8a3dab24b2&b&b=66609?callback=?'

the square brackets means array containing 1 item.

to first (and only) item in array, append [0] it.

in example:

document.write(fbresults[0].beatmapset_id); 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -