JsonParser.readTree () returns null after using JsonParser for default deserializer in jackson
The title doesn't define the problem, so here's the prblem description.
I have used the native deserializer in jackson for my purpose. I need to use defaul in my custom deserializer and change some of the fields in it. I did it based on This approach and here is my method:
public Test deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException, JsonProcessingException{
Test test = (Test)this.defaultDeserializer.deserialize(p, ctxt);
JsonNode node = p.getCodec().readTree(p);
// The rest of the code use node to change is some fields.
}
My problem is when the default deserializer is used, the node object will be null and I cannot use it to retrieve other fields from the json object. do you know how i can fix this problem?
+3
source to share
No one has answered this question yet
See similar questions:
or similar: