Skip to content

Version 0.8

Choose a tag to compare

@FoxSamu FoxSamu released this 06 Jan 00:27
· 6 commits to json since this release

This update improves serialization and the Kotlin wrapper. Get the release from my Maven repo:

Changes

  • Json.Builder.format is renamed to Json.Builder.serialization.
  • Default codec instances are now provided via JsonCodecs object, with Kotlin type-safety.
  • Improved serialiser output.
  • JsonSerializingConfig.ensurePointInNumbers is renamed to JsonSerializingConfig.enforcePointInNumbers.
  • JsonSerializingConfig now has a allowNonFiniteNumbers that sets whether NaN and Infinity are accepted by the serialiser.
  • Serialization now throws a checked SerializationException when the serialised JSON tree is not valid according to serialisation config. This means that serializing to string now throws a checked exception.
  • JsonPath and all related deprecated API has been removed.

In Kotlin

  • Kotlin constructor functions are now PascalCase to imitate constructor calls.
  • Added JsonCodec.nullableOf() to convert a JsonCodec<T> to a JsonCodec<T?> that accepts null values.
  • Added JsonCodec.arrayOf() which uses reified type generics to convert a JsonCodec<T> to a JsonCodec<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 new arrayOf() method is recommended instead.
  • Various functions that accepted lambdas are now inline.

Fixes

  • Fixed #3: NaN and Infinity are now properly handled by JsonNode.
  • 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.