is there a preferred JSON library?

I was thinking I’d use JSON instead of XML for save/load of files for a project.

I see that there are many implementations. The article Introducing JSON at json.org has an index at the end with many links.

Any suggestions as to how to go about choosing one?

stleary/JSON-java has 3.5K stars on github and is the first one listed.
Apache’s Johnzon looks very powerful.
Is this from Oracle?

There are also what look like simpler versions. I don’t know that I can anticipate all the ways I will want to use it going forward. I kind of like the idea of keeping an eye out for interacting with the web in some fashion.

But I’m also tempted to just keep using XML, too. So what if the save/load files are a little more verbose: the XML functionality is built in which makes packaging easier.

Jackson is pretty good

Hello

I use JSON-P and I plan to give a try to JSON-B. This library is already part of JavaEE / JakartaEE, its reference implementation is used in Glassfish. Anyway, Apache Johnzon has an implementation of the same API:

Jackson has the reputation of being faster but the last time I looked at it, it had a lack of modularity, i.e it wasn’t possible to get JSON support without XML support when using Maven. It has an implementation of the same JSR but it’s unmaintained:

I just use plain org.json from


Not sure if it’s good or not, but I’ve always liked it personally
1 Like

Jackson and Google’s GSON are both popular choices.

1 Like