this might be useful. don't know of any built-in functionality for this
a
Ayfri
01/18/2024, 5:12 PM
This isn't exactly what I want. I want to download some data online from a precise link known before compiling, currently I'm using the
fetch()
API from DOM, but I want to do this during compiling, not when going on the website.
s
S.
01/18/2024, 5:14 PM
you can just use the java http client in the gradle task
a
Ayfri
01/18/2024, 5:21 PM
Aaah, okay, good to know ! So I should download the JSON at compile time, write down a file containing a string containing the entire JSON, then decode it using Kotlinx.Serialization ?
Or do you have any better solution maybe ? 🤔
The syntax of the JSON is defined by myself on another repo so I can do whatever I want with it and I know what will be the syntax
s
S.
01/18/2024, 5:29 PM
apparently you can use kotlinx.serialisation directly in the gradle task by extending the JavaExec task, but I haven't tried this.
otherwise, yes, storing a json file and parsing it in the application code should work