Releases: FoxSamu/json
Releases · FoxSamu/json
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.
Version 0.7.2
From here and onwards, I will add releases to GitHub. Artifacts are still on Maven.
Changelog
- Split Kotlin to separate artifact.
Installation
The artifact can be installed from my Maven repository.
Gradle
repositories {
// Add my repository
maven { url "https://maven.shadew.net/" }
}
dependencies {
// Add the artifact
implementation "dev.runefox:json:0.7.2"
}Maven
<repositories>
<!-- Add my repository -->
<repository>
<id>Runefox Maven</id>
<url>https://maven.shadew.net/</url>
</repository>
</repositories>
<dependencies>
<!-- Add the artifact -->
<dependency>
<groupId>dev.runefox</groupId>
<artifactId>json</artifactId>
<version>0.7.2</version>
</dependency>
</dependencies>Download
You can also manually download the artifacts manually from my Maven repository:
Changelog of older versions, for reference
0.7.1
- Fixed NPE in
JsonNode.stream().
0.7
- Added
ObjectCodecBuilder, a builder forJsonCodecs that significantly simplifies making codecs that serialize Java objects to JSON objects with similar fields. JsonCodec.ofEnumnow has overloads that accept an enum'svalues()array instead of a class instance.- Removed some more
UncheckedIOExceptionusages.
0.6.4
- Kotlin is no longer a transitive dependency of the library. To use with Kotlin, the Kotlin dependency must be added
manually.
0.6.3
- Properly support unsigned integer types in Kotlin.
- Codecs for Kotlin's unsigned integer types, and range types.
- Document Kotlin API.
0.6.2
- In Kotlin, it is now possible to invoke
JsonNodes with a function as argument to configure them.
0.6.1
- Introducing support for Kotlin.
0.6
JsonSyntaxExceptionnow provides getters for the exact location and problem of the error.- Added various new
JsonCodecs for differentTemporalAccessortypes. - There are now instance methods on
JsonCodecthat create wrapper codecs. They all have an equivalent static factory method. - Parsing and serializing now throws
IOExceptions instead ofUncheckedIOExceptions. - Fixed the issue causing
JsonInputtrying to read from the stream beyond the end of the document, causing a blocking stream (such as a socket stream) to block even though an entire document has been read and is ready to be handled.
0.5.2
- Added
flush()toJsonOutput.
0.5.1
- Added support for streaming multiple JSON documents over a single stream, through two new interfaces
JsonInputandJsonOutput. - The project now has a named module and can now be used as a dependency in other module-based projects.
0.5
- Changed base package name and artifact group from
net.shadewtodev.runefox - Added
merge(...)which merges an object into the main object - Added
JsonNode.arrayCollector(...)that takes a mapping function to quickly map Java objects to JSON in aStream. - Added
JsonNode.objectCollector(...)that takes two mapping functions to collect elements into an object. - Added
wrap()to quickly wrap a node into a new array andwrap(...)to quickly wrap a node into a new object under a given key. - The
JsonNode.numberArray(...)methods taking primitives no longer accept varargs, except for the one takingNumberobjects, because the Java compiler would find it ambiguous otherwise. - Fixed serializer expecting an object or array despite
FormattingConfig.anyValuebeing set to true.
0.4
- Added new methods for checking values of object elements (i.e.
isBoolean(String key)) - Added
MissingKeyExceptionthat can be thrown when a required key is missing - Fixed
isPrimitivereturning true for all JSON structures andisConstructreturning false for all JSON structures - Deprecated
JsonPathandJsonNode.query(...)methods
0.3.2
- Fixed
NoSuchMethodErrorwith Android not desugaringtoArray(IntFunction)
0.3.1
- Fixed floating point numbers between 0 and 1 being rounded to 0 in
JsonNode.number()
0.3
- Added the codec system for easy encoding and decoding of Java objects to/from JSON trees
- Fixed
toStringreturningdev.runefox.json.BooleanNode@.....for boolean types, makingtoStringJSON data not parsable - A new unchecked exception,
JsonException, is now the superclass of all the exceptions thrown by the assertions inJsonNodemethods, as well as exceptions thrown from codecs - Added
JsonNode.arrayCollector()for easily collecting allJsonNodes in aStreaminto an array node - The numeric values returned from
JsonNodes should now be closer to the actual value stored in the JSON data JsonRepresentablenow replacesJsonSerializable, and aJsonNodeis nowJsonRepresentableJsonNode.fromJavaObjectis now deprecated and only for debug purposes- Improved documentation
0.2.1
- Add methods to create array nodes from arrays of primitives
0.2
- It's now possible to parse JSON that is not an object or array at root (can enabled in
ParsingConfig) - Added
Jsonpresets with compact printing - Various new
JsonNodeAPI for reading and writing a JSON structure IncorrectArrayLengthExceptionhas been replaced withIncorrectSizeExceptionJsonTypehas now has some extra API- Serializing a JSON node that is not an object or array now throws an exception (this check can be disabled in
FormattingConfig) - Surrogate pairs are now treated as one code point when parsing
- Improved documentation
0.1
Initial release