This module basically fetches JSON data from an URL and parses as a flat data structure to be used on Views displays.
So, how to use it? Install the module and enable it.
Create a new view and choose Json option at Show select box:
Then fill the rest of the fields as you normally do.
Now you need to define from where the data is coming. Click on Advanced and then Query settings: Settings.
Fill the Json File text field with the source URL:
You should fill Row Apath field with the data key you want to retrieve. For example, the JSON data we’re working on has the following structure:
'position': 'CEO & partner',
So you should use persons as the row apath.
Be aware that for a structure like this:
The find method used on row apath won’t work because no key is given for the collection. This issue already being addressed by the maintainers of the module.
Now, let’s get some values into our view table. By default, one empty field is added to your view fields so just click on that one:
Give a name to the label and on Key Chooser field, well, choose the key:
If you want to render an image from an url just enable the Rewrite results when editing the field:
Apply, save et voilá! External data on your site, always up-to-date!
As you can see on the example data structure we have a node “contact” that contains email and phone attributes. How do you fetch those fields? Simple, on Key Chooser field just fill contact/email or contact/phone. And you can do that on any number of levels, e.g. contact/email/work, contact/phone/work/primary.
And that’s all to it. Very simple stuff but definitely very handy.