#JSON library

13 messages · Page 1 of 1 (latest)

vestal wagon
#

I want to convert a scene in my renderer to a JSON file that can then be read from later to load the scene again. The Scene class isn't a POJO, so I need to write my own "logic" for the conversion from data in the program to the JSON file. I've looked at libraries like Google GSON and Jackson, but these seem to be more suited to directly converting JSON files to classes and vice versa (correct me if I'm wrong on this).

I then found the json-simple library through this tutorial (https://howtodoinjava.com/java/library/json-simple-read-write-json-examples/) - it seems to work, but it looks a bit outdated. Does this matter?

If anyone has any suggestions for which JSON library I should use, please let me know.

crude eagleBOT
#

This post has been reserved for your question.

Hey @vestal wagon! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

warm shore
#

are you familiar with JSON itself?

vestal wagon
#

Yes

warm shore
#

you could serialize the class yourself then

vestal wagon
#

Yeah, that's what I plan to do

warm shore
#

deserializing would be a pain there though

vestal wagon
warm shore
#

well, you'd have to parse it yourself

#

assuming you want to use or omit the same libraries for serialization and deserialization at least

#

but these seem to be more suited to directly converting JSON files to classes and vice versa
i don't think that's really a problem tbh, the classes aren't for you to use in code, the classes are for linking existing classes to json afaik

vestal wagon
#

I see