path() rather than get() for safe navigation — get() returns null for missing fields, while path() returns a MissingNode that safely returns empty/default values from accessor methods.
| Class | JSON type | Key methods |
|---|---|---|
ObjectNode | {"key": value} | get(field), put(), set(), remove(), fields() |
ArrayNode | [elem, ...] | get(index), add(), insert(), remove(), size() |
TextNode | "string" | asText(), textValue() |
IntNode | 42 | asInt(), intValue() |
LongNode | 1234567890123 | asLong(), longValue() |
DoubleNode | 3.14 | asDouble(), doubleValue() |
BooleanNode | true/false | asBoolean(), booleanValue() |
NullNode | null | isNull() |
MissingNode | (absent field) | isMissingNode() |
ObjectNode or ArrayNode only after checking isObject() or isArray() — otherwise you risk a ClassCastException if the JSON structure does not match your assumption.