Version 0.8
This update improves serialization and the Kotlin wrapper. Get the release from my Maven repo:
- https://mvn.runefox.dev/#/releases/dev/runefox/json/0.8
- https://mvn.runefox.dev/#/releases/dev/runefox/jsonkt/0.8
Changes
Json.Builder.formatis renamed toJson.Builder.serialization.- Default codec instances are now provided via
JsonCodecsobject, with Kotlin type-safety. - Improved serialiser output.
JsonSerializingConfig.ensurePointInNumbersis renamed toJsonSerializingConfig.enforcePointInNumbers.JsonSerializingConfignow has aallowNonFiniteNumbersthat sets whetherNaNandInfinityare accepted by the serialiser.- Serialization now throws a checked
SerializationExceptionwhen the serialised JSON tree is not valid according to serialisation config. This means that serializing to string now throws a checked exception. JsonPathand all related deprecated API has been removed.
In Kotlin
- Kotlin constructor functions are now PascalCase to imitate constructor calls.
- Added
JsonCodec.nullableOf()to convert aJsonCodec<T>to aJsonCodec<T?>that acceptsnullvalues. - Added
JsonCodec.arrayOf()which uses reified type generics to convert aJsonCodec<T>to aJsonCodec<Array<T>>. - The
JsonCodec.arrayOf { ... }method's lambda now takes a second parameter, which is a function that maps indices to decoded values. Use of this method is now discouraged and the newarrayOf()method is recommended instead. - Various functions that accepted lambdas are now
inline.
Fixes
- Fixed #3:
NaNandInfinityare now properly handled byJsonNode. - Fixed the parsing of the non-execute prefix not working.
- Fixed number nodes not properly converting to Kotlin unsigned values when overwflowing their signed counterparts.