Search code examples
jsonjekyll

Jekyll site data with dots in identifier


Assume you have a JSON file _data/test.json with the following content

{"foo.bar":"42"}

and you want to query it in Jekyll/Liquid. A naive try would look like:

{{ site.data.test."foo.bar" }}

which does not work. Any idea how to look up "foo.bar"?

I'm using Jekyll 3.8.


Solution

  • You could use the alternate syntax as well:

    {{ site.data.test["foo.bar"] }}