#Need help with saving data to Json

22 messages · Page 1 of 1 (latest)

urban escarp
#

Using JsonIO.read() you can read from json files, what is the inverse of this, how do you save to a json file

also what is the way to convert dev.latvian.mods.rhino.NativeObject objects to string

see attatched for code

dusk idolBOT
#

Paste version of spawn_con.js from @urban escarp

quiet cometBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

dusk idolBOT
#

Here's a simple snippet showing how to use JsonIO to read/write JSON files anywhere within the Minecraft folder:

// Reading the contents of the file from the given path
config = JsonIO.read('kubejs/config/myawesomeconfig.json')

// Writing to an existing/new file
JsonIO.write('kubejs/config/myawesomeconfig.json', {settinga: 'creeper', weirdblock: 'minecraft:end_gateway'})
wary zinc
#

thats for writing the json

#

to convert to string, is there no toString()?

#

you can also try .getString() if i remember correctly (some classes use that instead)

urban escarp
#

i tried that and it didn't work

wary zinc
#

the tostring?

urban escarp
#

both

wary zinc
#

what error did you get

urban escarp
#

tostring and getstring

#

no method found in object Object

#

which is weird cus it's nativeobject

wary zinc
#

hm

urban escarp
#

well doesn't matter cus the write read the native object fine

#

thanks for the help :D

wary zinc
urban escarp
#

:3