#Import JSON file into data storage

1 messages · Page 1 of 1 (latest)

olive rampart
#

Is it possible for me to put a .json in my datapack files and directly import that into data storage ingame?

tardy thunder
#

No.

#

Except with beet or sth

#

Why?

latent rapids
#

You could use a dialog, but the more important question is indeed: why?

olive rampart
#

I may be ignorant to a better method, but it seems like the cleanest way to import a large dataset. I suppose I could just use a single /data modify storage command to set the array, but it seems like I would have to remove all of the linebreaks from the .json which is tedious (unless there's some sort of automation tool for this). If there's a better way please let me know, thanks for the help 🙂

ocean tusk
#

There isn't

#

If we could, you're correct that it would be the best method to import a large data set, but we can't

#

Data packs are not a full programming language, there are some things that they're just not intended to do and also aren't good at.

olive rampart
# ocean tusk Data packs are not a full programming language, there are some things that they'...

Makes sense, so what approach do people tend to implement? Is it considered better practice to import the entire dataset as a single line with /data, or should I use multiple lines with each one appending the next item in the array? I can see benefits and drawbacks to either approach, though I suppose one maybe isn't inherently superior but I'm curious what experienced devs tend to prefer

ocean tusk
#

I don't think people tend to do this period, but the closest thing I've done, yes I did with a data command to set the storage in the load function as a single line.

olive rampart