Best way to approach JSON files?


I want to use Hugo to generate a serve some JSON data driven by hugo’s templating engine.

I can generate JSON files for list.json and single.json, but if I wanted to provide additional routes for lists, what would be the best way to approach this?

I’d like three different routes serving JSON for a specific content type (i.e. “data”) .
/data/list.json - Minimal amount of information of each “data”.
/data/full.json - Heavy amount of information of each “data”.
/data/specific.json - Specialized information of each “data”.

Anyone happen to have any suggestions?
Thank you.

I use a JSON file for each type of data, so “A.json” and “B.json”. I could put both into the same file – they are related – but found that extra level of objects not convenient to work with. For me, it added an extra layer of abstraction that made it harder to quickly find the line in the JSON file where I wanted to make changes.

For that I don’t think anyone can advise you on what “the best approach” is, because it depends on the type of data, the amount of data, how often you’ll have to edit/update the JSON files, where you make edits in the data files by hand or with code.

And most importantly: what your preferred approach for dealing with JSON files is so that over six months from now, you can still understand the structure of your own data and how you referenced it in Hugo. Perhaps you are a master of abstraction and JSON. I’m not, and so I use small, specific files instead of something like /data/full.json.

Hope this helps.