-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
Jackson version: 2.9.4
Sample code demonstrating the problem:
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="_class")
public class LongContainer {
@JsonProperty
private Long longObj;
public static void main(String[] args) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
JsonNode tree = objectMapper.readTree("{\"longObj\": 1519348261000.0, \"_class\": \"LongContainer\"}");
LongContainer obj = objectMapper.treeToValue(tree, LongContainer.class);
System.out.println(obj.longObj);
}
}
It's caused by this line. Curiously enough, it works fine if you deserialize a plain float value into Long.class
since that uses TreeTraversingParser
instead of TokenBuffer
.
Metadata
Metadata
Assignees
Labels
No labels