JsonNodePath
Namespace: Meshmakers.Octo.Sdk.Common.EtlDataPipeline.JsonPath
Reads and mutates an in-memory tree by JSONPath, and normalizes
user-supplied path strings to a canonical rooted form. Writes (Set/Remove) are
dotted-only by design — multi-match writes use IDataContext.UpdateMatchesAsync
instead. The read members (JsonNodePath.Select(JsonNode, String)/JsonNodePath.SelectAll(JsonNode, String)) are thin public
entry points over the single generic JsonPathWalker (no second walker); they
exist for callers that already hold a raw subtree (e.g. adapter nodes
doing structural grouping/sorting) rather than an IDataContext. They return the
matched node by reference into the root subtree — no clone, no serialize.
public static class JsonNodePath
Inheritance Object → JsonNodePath
Methods
Select(JsonNode, String)
The first node matching path on root, or null
when no match exists or root is null. Walks by reference via
JsonPathWalker — the returned node is a live reference into root.
public static JsonNode Select(JsonNode root, string path)
Parameters
root JsonNode
path String
Returns
JsonNode
SelectAll(JsonNode, String)
All nodes matching path on root in document order
(empty when no match or root is null). Full JSONPath dialect via
JsonPathWalker; each yielded node is a live reference into root.
public static IEnumerable<JsonNode> SelectAll(JsonNode root, string path)
Parameters
root JsonNode
path String
Returns
Set(JsonNode, String, JsonNode)
Sets the value at path on root, creating
intermediate nodes for any missing dotted segments.
public static void Set(JsonNode root, string path, JsonNode value)
Parameters
root JsonNode
Root object to mutate.
path String
JSONPath expression. Must be a dotted property path (no indices, wildcards, filters, or recursive descent).
value JsonNode
Value to assign at the path.
Exceptions
JsonPathNotSupportedException
Thrown if the path contains an indexed segment, wildcard, filter, or recursive descent,
or if an intermediate node along the path exists but is not a .
Remove(JsonNode, String)
Removes the property at path. Returns true if a property was removed.
public static bool Remove(JsonNode root, string path)
Parameters
root JsonNode
Root object to mutate.
path String
JSONPath expression. Must be a dotted property path (no indices, wildcards, filters, or recursive descent).
Returns
Boolean
True if a property was removed; false if the path did not resolve to an existing property.
Exceptions
JsonPathNotSupportedException
Thrown if the path contains an indexed segment, wildcard, filter, or recursive descent.
NormalizePathOrRelative(String)
Normalizes user-supplied JSONPath strings — bare ("id"), leading-dot (".id"),
rooted ("$.id"), and bracket-rooted ("$['foo-bar']") all resolve to a canonical
rooted form. Replaces the per-node NormalizeRelative duplicates.
public static string NormalizePathOrRelative(string path)
Parameters
path String