Let’s first say I have an JSON file named users.json and I wish to iterate through the data in it to display the full name of every user. I would do it like this:
{{ range .Site.Data.users}}
<li>{{.first}} {{.last}}</li>
{{ end }}
If instead I have multiple json files for multiple pages and for each page I have an .md (markdown) file that stores (among other things) the name of its json file to use in a variable called datafile I would do:
{{ range .Site.Data.{{.Params.datafile}}}}
<li>{{.first}} {{.last}}</li>
{{ end }}