I've been playing somewhat with the Flickr API lately since I've been preparing a workshop in introductory jQuery, and the Flickr API is a great example in doing GETs for JSON content. However, the Flickr API returns JSONP instead of JSON by default. A typical response:
jsonFlickrApi({ "photos": { "page": 1, "pages": 1033, "perpage": 100, "total": "103268", "photo": [{...}] } })
In order not to confuse my students, I wanted to start using pure JSON, i.e. letting the response be
{ "photos": { "page": 1, "pages": 1033, "perpage": 100, "total": "103268", "photo": [{...}] } }
I couldn't find this in the Flickr API docs, which are rather good, but later I found out that you can append &nojsoncallback=1 to the request URL to accomplish the latter response.
0 kommentarer:
Post a Comment