I’m trying to grab images from Flickr API, it returns it in XML format but they also have an argument for format=json
I get the following when I submit it
jsonFlickrApi({“photos”:{“page”:1,“pages”:547568,“perpage”:1,“total”:547568,“photo”:[{“id”:“51964262546”,“owner”:“194499057@N06”,“secret”:“fb65aea0be”,“server”:“65535”,“farm”:66,“title”:“Shark In The Water”,“ispublic”:1,“isfriend”:0,“isfamily”:0}]},“stat”:“ok”})
I have it set to a single photo just for my own clarity but I cannot get this to convert to an object to grab the properties.
That’s not valid JSON. It’s not formatted properly. You should be able to paste the JSON response text into Best JSON Viewer and JSON Beautifier Online and see the “tree” of values on the right side. Once you’ve got that working, post the corrected text and we can help you with the get property blocks.
Edit: sorry! Stupid smart quotes. The JSON is fine:
{"photos":{"page":1,"pages":547568,"perpage":1,"total":547568,"photo":[{"id":"51964262546","owner":"194499057@N06","secret":"fb65aea0be","server":"65535","farm":66,"title":"Shark In The Water","ispublic":1,"isfriend":0,"isfamily":0}]},"stat":"ok"}
The problem is that the “photo” property is an array/list. So you need to get the first list item of “photo” before you get the “id” property of that item.
So, since the JSON is valid and the blocks work, it means you need to do two things:
Check the value of the green error block to see if the API server is working properly. Assign that block to a label to check it.
Check the value of the green response block. Assign that block to a text input and then copy and paste the value into Best JSON Viewer and JSON Beautifier Online to see if it recognizes it as valid JSON.