The data is not easy to format. Why not suggest something like this?
async function fromEurostat(query) {
const result = await d3.json(query);
const category = result.dimension.geo.category;
return Object.keys(category.index).map((key) => ({
id: key,
label: category.label[key],
value: result.value[category.index[key]]
}));
}
fromEurostat(
"https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/reg_area3?format=JSON&unit=KM2&landuse=TOTAL&lang=EN&TIME=2025"
)
Of course, this would need to be improved when there are several indicators or several years. But we want to retrieve the data formatted in this way.
Unfortunately I am not involved in the API development, I'm just a consumer of it! I suggested something a while ago but they do not want to deviate from JSON-stat
Yes, maybe it would be nice to have some examples here of formatting responses that contain multiple years and also an option to include a value's 'status' flag (e.g. 'estimated'). I will add them when I can!