This post builds on the previous one (Grabbing the Output of a Yahoo Pipe into a Web Page) by describing a strategy that can help you explore the structure of a JSON feed that you may be pulling in to a web page so that you can identify how to address the separate elements contained within it.
This strategy is not so much for developers as for folk who don’t really get coding, and don’t want to install developer tools into their browser.
Here’s part of a typical JSON feed out of a Yahoo pipe:
One of the things I tend to take for granted about using Yahoo Pipes is how to actaully grab the output of a Yahoo Pipe into a
However, we can can use the Yahoo pipes environment to help us understand the structure and make up of this feed. Create a new pipe, and just add a “Fetch Data” block to it. Paste the URL of the JSON feed into the block, and now you can preview the feed – the image below show a preview of the JSON output from a simple RSS proxy pipe, that just takes in the URL of an RSS feed and then emits it as a JSON feed:
(Note that if you find yourself using the Yahoo Pipes V2 engine, you may have to wire the output of the Fetch Data block to the output block before the preview works. You shouldn’t need to save the pipe though…)
When you load the feed in to a webpage, if you assign the whole object to the variable data, then you will find the output of the pipe in the object data.value.
In the example shown above, the title of the feed as a whole will be in data.value.title. The separate feed items will be in the collection of data.value.items; data.value.items gives the first item, data.value.items the second, and so on up to data.value.items[data.value.items.length-1]. The title of the third feed item will be data.value.items.title and the description of the 10th feed item will be data.value.items.description.
Here’s a preview of a council feed from OpenlyLocal:
In this case, we start to address the data at data.council, find the population at data.council.population, index the wards using data.council.wards[i] and so on.
One thought on “Previewing the Contents of a JSON Feed in Yahoo Pipes”
Comments are closed.