Releases: jdereg/json-io
Releases · jdereg/json-io
4.96.0
Highlights
- 25 annotations for declarative serialization control (
@IoProperty,@IoIgnore,@IoCreator,@IoValue,@IoFormat,@IoNaming, and more) — with Jackson annotation compatibility at zero compile-time cost - Spring Boot starter — expanded YAML configuration for
WriteOptionsandReadOptionswithout writing Java code - TOON format enhancements — tabular POJO format, configurable delimiters, cycle support with
$id/$ref, and full type metadata emission - Significant performance optimizations across parser, writer, resolver, and injector hot paths
Features
- Spring Boot starter — expanded YAML configuration properties. All commonly used
WriteOptions/ReadOptionssettings now configurable viaapplication.yml. New write properties:force-map-output-as-two-arrays,write-enum-as-json-object,cycle-support,json5,date-format,indentation-size,show-root-type-info,meta-prefix,toon-delimiter. New read properties:use-unsafe,floating-point,integer-type. AnnotationResolver— 25 annotations incom.cedarsoftware.io.annotationfor full declarative serialization control:@IoProperty,@IoIgnore,@IoIgnoreProperties,@IoAlias,@IoPropertyOrder,@IoInclude,@IoCreator,@IoValue,@IoNaming,@IoIncludeProperties,@IoIgnoreType,@IoTypeInfo,@IoDeserialize,@IoClassFactory,@IoGetter,@IoSetter,@IoNonReferenceable,@IoNotCustomReader,@IoNotCustomWritten,@IoCustomWriter,@IoCustomReader,@IoTypeName,@IoAnySetter,@IoAnyGetter,@IoFormat.- Jackson annotation compatibility — json-io reflectively honors Jackson annotations when the Jackson JAR is on the classpath with zero compile-time dependency. json-io annotations take priority.
ToonWriter— tabular format for POJO collections/arrays (compact CSV-style[N]{field1,field2,...}: row1 row2 ...).ToonWriter— configurable delimiters (comma, tab, pipe) encoded in count bracket for auto-detection on read.ToonWriter— TOON type metadata emission (@type/@t/$type/$t) when type output is enabled.ToonWriter— defaults TOON metadata keys to$variants ($id/$ref/$items/$keys) for JSON5-friendly output.ToonWriter— usesWriteFieldPlan/Accessorabstraction, giving TOON automatic support for all write-side annotations.
Improvements
@typeelimination — now considers@IoDeserialize(as=X)and@IoTypeInfo(X)annotations, producing smaller JSON without sacrificing round-trip fidelity.AnnotationResolver— usesClassUtilities.forName()for proper classloader resolution in OSGi/JPMS environments.
Performance
Accessor.retrieve()— sticky fallback flags for lambda/VarHandle/MethodHandle paths; failed paths bypassed on subsequent calls.Injector— numeric kind and primitive-wrapper lookups now useClassValueMapO(1) dispatch.Injector.inject()— assignability-based pre-conversion reduces exception-driven control flow.JsonIo— thread-local buffer recycling in String-based JSON paths removes repeated stream/buffer construction.JsonObject.appendFieldForParser()— parser-only fast path avoidsindexOfduplicate-key search.JsonParser— read numeric pipeline optimized with directDouble.parseDouble()fast path for DOUBLE mode and primitive-array direct assignment.JsonParser— ASCII-only lowercase conversion, lookup-table hex parsing, bounded string dedupe caching, simplified strict-mode handling.JsonWriter— string escaping with precomputed control escape strings; unified smart-quote decision logic.JsonWriter— class-cached custom-writer gate checks viaClassValueMap.JsonWriter—cycleSupport(false)bypassesobjsReferenced/@idlookup across all write hot paths.JsonWriter.writeMapBody()— hoisted invariants reduce per-entry branch checks.Resolver— target-kind based scalar coercion with precomputed kinds in array/field hot loops and direct no-allocation primitive array writes.ReadOptionsBuilder/WriteOptionsBuilder— cached injector/write-field planning reduces repeated reflection/generic analysis.
Bug Fixes
JsonWriter.write()— always clearsobjVisited/objsReferencedinfinallyblock, preventing state leakage.JsonWriter.traceReferences()— fixed off-by-one in object-limit enforcement.JsonWriter/ToonWriter—cycleSupport(false)throwsJsonIoExceptionwith remediation hint;cycleSupport(true)retains normal id/ref handling.ObjectResolver— map generic typing preserves both key and value generic types during traversal.ObjectResolver.processJsonObjectElement()— preserves explicit element@typemetadata in arrays for polymorphic deserialization.ObjectResolver— generic inference now runs incrementally instead of deepmarkUntypedObjects()pre-pass.ObjectResolver.assignField()— applies@IoDeserialize/@IoTypeInfooverrides for TOON list-style arrays/maps.Resolver.wrapException()— preserves causal chain withJsonIoException(message, cause).Resolver.toJava()— supports TOON key/value entry-list conversion for concrete Map subclasses.ToonWriter— applies@IoPropertyrename and@IoPropertyOrderreordering.ToonWriter— indents nested referenced-map id metadata correctly.ToonReader— recognizes all TOON metadata key variants for full id/ref identity round-trip.
Install
Maven
<dependency>
<groupId>com.cedarsoftware</groupId>
<artifactId>json-io</artifactId>
<version>4.96.0</version>
</dependency>Gradle
implementation 'com.cedarsoftware:json-io:4.96.0'