JSONUtil 1.9 has been released. Get it here
This release includes several new features.
The most notable is that reflection of objects for encoding JSON is now supported. There is a Wiki page about how to use reflection with this package. It can reflect only certain classes that you choose or you can have it reflect all unknown objects. You can selectively pick fields to include with objects or you can let it pick based upon class privacy (public, protected, package or private). There is an option for caching to help with reflection performance at a cost of memory.
JSONParser now supports a JSONConfig option called “smallNumbers” which tries to store numbers in the smallest primitive possible without losing information.
It also supports an option called “usePrimitiveArrays” that causes it to look for lists that look like arrays of primitives and if possible, turn them into arrays of primitives using the smallest primitive type possible without losing information.
When the parser cannot store a number in a 64-bit double or a 64-bit long integer, then it will use BigDecimal or BigInteger to store the number. You can decide if you want to lose precision after that.
If the JSONConfig option encodeNumericStringsAsNumbers is true, then the parser will look at strings to see if they look like numbers and will encode them as such if they do.
JNDI now supports setting a string called org/kopitubruk/util/json/appName which is used to augment the JMX MBean name so that multiple apps can have their own version of the JSONConfigDefaults MBean in the same web tier container at the same time. It can also be set with a -D option on the command line (using dots instead of slashes) if you’re not using JNDI.
There was a bug with indent padding and null values. It has been fixed.
If you’re using Java 7 or earlier, download the jars with your Java version number. Otherwise just get the regular jars that don’t have a Java version in their name. They require a minimum of Java 8.
The binaries are also available at the Maven Central Repository