ReflectionDiffer

A class using Kotlin reflection to implement JSON Merge Patch (RFC 7386) against data classes. This approach loses type-safety, so you need to ensure that the structure of the JsonObject matches exactly the structure of the data class you want to apply the diff on. If something unexpected happens, SerializationException gets thrown.

Functions

Link copied to clipboard
fun <T : Any> applyDiff(obj: T, diff: JsonObject): T
Link copied to clipboard
inline fun <T> Json.decodeOr(key: String, json: JsonObject, default: () -> T): T