Skip to content

Virtual vs Actual Tree

Jan Bernitt edited this page Jan 20, 2024 · 2 revisions

A JsonVirtualTree is a virtual tree of JsonValue nodes, each type with a node type specific interface.

Underlying implementation of the actual JSON document is the JsonTree which exposes all node types as JsonNode.

JsonValue API JsonNode API
JsonValue#node() => <= JsonValue.of(node)
virtual 👻 actual ☠️
high level abstraction low level abstraction
the JSON assumed the actual JSON
navigation without requiring existence (no exceptions) navigation demands existence (otherwise throws exceptions)
extendable tree API non-extendable tree API
JsonObject, JsonArray, JsonNumber, JsonString, JsonBoolean JsonNode + JsonNodeType
JsonValue (API all above have in common) JsonNode
JsonMixed (API of all above togehter) JsonNode
read-only (with views) immutable (transformations to new trees)
extendable user type mapping (see JsonTypedAccessStore) build in mapping to JDK types
Clone this wiki locally