Static JSON to Elm at Compiletime

I’m in the process of updating my porfolio site and was thinking “how good would it be if i could just update a JSON file when i need to change it instead of going into the code itself”. So naturally, i looked into JSON decoding and accessing JSON files and settled on a basic HTTP request to fetch a public JSON file and decode that on runtime, populating the site with the decoded info. Awesome, thats done!

But, thats not really what i wanted for originally, so i kept looking for anything relating to decoding JSON at compile time and i couldnt find anything! Everyone seems to only want to use JSON from HTTP requests and not as config / site copy files.

So i was wondering if i’ve missed something, or if anyone knows the best way i can take a JSON file and decode it at compile time, avoiding the use of any HTTP requests! I’m open to anything :slight_smile:

https://elm-pages.com/ might be the closest to what you’re looking for, that I’m aware of

If you have the actual json or can/want to pipe the contents into elm-codegen then:

Updating an Elm file sounds easier than updating a JSON file (since the compiler helps you with Elm code but not JSON), at least without not knowing more about your project!

I used a little node wrapper to preparse DXF into elm; elm-pages might give you a more prepackaged way to run the prep step. GitHub - JustinLove/hades-boons: Interactive web chart of Hades Boons · GitHub