LenientConverters

A collection of lenient converters that can handle type mismatches in JSON data.

These converters attempt multiple conversion strategies when the actual type in JSON differs from the expected type. They follow a fail-safe pattern: returning null for invalid or non-representable values rather than crashing or producing corrupted data.

Edge cases handled:

Example usage:

val payload: DataObject = ...
val timeout = payload.get("timeout", LenientConverters.DOUBLE)
val retryCount = payload.get("retryCount", LenientConverters.INT)
val isEnabled = payload.get("isEnabled", LenientConverters.BOOLEAN)

Properties

Link copied to clipboard

A lenient converter to Boolean values.

Link copied to clipboard

A lenient converter to Double values.

Link copied to clipboard

A lenient converter to Int values.

Link copied to clipboard

A lenient converter to Long values.

Link copied to clipboard

A lenient converter to String values.