'How do I modify an IntNode?

Java Jackson question here:

I'm trying to edit a JsonNode created by objectMapper.readTree,

jsonNode = objectMapper.readTree(json);

, but it automatically turned some of the branches of the node into IntNodes. If it were a string, I could easily edit the value like so:

((ObjectNode)jsonNode).put("name","newvalue");

But if it's a number,

 ((IntNode)jsonNode).put("number",42);

Will fail because 'put' is not a method of IntNode.

How do I modify an IntNode?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source