I have a payload like this:
items: [
{
"foo" : "baz",
"whatever" : "thing"
}
]
Literally, all I have to do is just navigate to /items/0
and then continue the normal deserialization process. But I don't see how I can do that with the current JsonDeserializer.
class BugDeserializer : JsonDeserializer<Bug>() {
override fun deserialize(p: JsonParser?, ctxt: DeserializationContext?): Bug {
val node: TreeNode = p!!.readValueAsTree()
val correct = node.at("/items/0")
// Now what? 'correct' has no `readValueAs` method
return p.readValueAs(Bug::class.java)
}
}
Once I navigate properly, I don't see anyway to thus "continue". I have gone so far as to instantiate another ObjectMapper
to do the job, but this doesn't work either because I have the deserializer directly on my Bug
class, so it gets invoked twice.
How do I simply deserialize normally, once I've navigated to the correct json path?