#Read json

21 messages · Page 1 of 1 (latest)

lilac compass
#

Hi! I've seen there are many ways to manage JsonElement objects and convert it to and from Nbt.
But I have a way smaller problem, I can't find a way to just parse the content of the json file to a Json object.

I know it's the dumpest question ever, so I expect the simplest answer that can help me now and someone else later.

soft hare
#

where is the json coming from?

lilac compass
soft hare
#

well in that case just use gson

lilac compass
soft hare
#

convert the input stream into a reader

#

then pass to gson's fromJson

lilac compass
#

The only thing I've found is the JsonReader object, but that then requires me to check every key

soft hare
#

no a InputStreamReader

lilac compass
lilac compass
soft hare
#

no? gson can desialize most things

lilac compass
soft hare
#

try and see

#

if not use a codec

lilac compass
#

I'll go for CODEC

#

what's the equivalent of Text.CODEC? It looks like it does not exist

lilac compass
#

Even having created a CODEC I need to parse the file into a JsonElement.
Again, this is the difficult part, pls help

noble crow
#

Use JsonParser