#imported objects are empty on page refresh

3 messages · Page 1 of 1 (latest)

crimson parrot
#

I have a json file containing an array of objects.
Example:
[
{
"src": "/banners/2022-10.png"
},
]

This works fine if I have just saved the json file, but if i refresh or save another file, the imported array becomes empty ([]) Why?

ebon crystalBOT
#

Hi @crimson parrot. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the Astro documentation on importing JSON files (https://docs.astro.build/en/guides/imports#json) for more information on how to properly import and use JSON files in your Astro project.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

Astro Documentation

Learn how to import different content types with Astro.