How to access custom JSON file in shopify at liquid file level

Viewed 5253

I know it is possible to access a JSON file at the JavaScript level on the front end, but is it possible to access a JSON file and its contents in /assets/ folder (or elsewhere if need be) at the Liquid level?

I was hoping for something like

{{ '/assets/some_file.json.liquid' | example_object.inner_object.some_key }}

3 Answers

I got here in a search for ability to fetch and process a JSON file that attached to the Collection through metafield, unfortunatelly accepted solution didn't worked for me returning error.

The code below worked: {{collection.metafields.my_fields.fieldname.value.url}}

the ending .value.url is returning full path to the JSON file that is attached via metafields

Related