-
-
Notifications
You must be signed in to change notification settings - Fork 819
Closed
Description
In Jackson 3, JsonParser.readAsValues was removed.
I was using Jackson 2 to stream-read a huge number of POJOs from a Reader.
They were separated by newlines. It worked.
The reading happened in a streamed way: neither input data nor output data was pre-stored.
I had empirically proven it, by reading billions of items in a very limited Java-heap.
Now I need an alternative solution.
Is is still somehow possible in Jackson 3?
Pseudo-code of my Jackson 2 solution (I could not quickly extract real code from the actual project)
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "@T")
data class MyPOJO(val s: String, val b: Boolean)
// NOTE: POJOs separated by newlines - and, this time I use String instead of Reader to simplify the example
val text: String = """
{"@T":"MyPOJO","s":"item-1","b":true}
{"@T":"MyPOJO","s":"item-2","b":true}
{"@T":"MyPOJO","s":"item-3","b":true}
"""
val parser: JsonParser = /* ... */
val iterator: Iterator<MyPOJO> = parser.readValuesAs(MyPOJO::class.java)
// "iterator" contained 3 POJOs, correctly deserialized
Metadata
Metadata
Assignees
Labels
No labels