nodesIn

fun nodesIn(document: Variant, limits: JsonPathLimits = this.limits): List<VariantNode>

The same, materialised.

For a caller who wants the count, or an index into it, or to iterate twice. O(nodes) in memory where forEachNodeIn is O(1). The nodes it holds are still views and the lifetime rule on forEachNodeIn applies to them unchanged: the list outlives the call, the bytes behind the values do not.

This is the shape JsonPathLimits.maxNodesProduced is really for: a sink can drop what it does not want, and a list cannot.

Throws

if the evaluation costs more than limits allows, in which case no list is returned at all.