asValue
Converts a flow of JsonNode objects into a flow of objects of the specified type, using the provided ObjectMapper.
Return
A flow of objects of the specified type.
Example usage:
data class Person(val name: String, val age: Int)
val objectMapper = ObjectMapper()
val jsonNodeFlow = flowOf(
objectMapper.readTree("""{"name":"Alice","age":30}"""),
objectMapper.readTree("""{"name":"Bob","age":25}""")
)
jsonNodeFlow.asValue<Person>().collect { person -> println(person) }
Content copied to clipboard
Parameters
objectMapper
The ObjectMapper instance to use for converting JsonNode objects to objects. Defaults to defaultObjectMapper.