Namespace: Json.Path
Inheritance: JsonNodeExtensions
🡒 object
Useful extensions for System.Text.Json.Nodes.JsonNode.
Methods
TryGetSingleValue(this JsonNode node, out JsonNode value)
Ensures a System.Text.Json.Nodes.JsonNode only represents a single value.
Declaration
1
public static bool TryGetSingleValue(this JsonNode node, out JsonNode value)
Parameter | Type | Description |
---|---|---|
node | JsonNode | Â |
value | out JsonNode | Â |
Returns
Within the context of this library, a Json.Path.NodeList may be stored inside a System.Text.Json.Nodes.JsonNode. Some operations, such as expression addition, require that a single value is provided.
This method checks to see if the underlying value of a JsonNode
is a NodeList
. If not, it simply setsNodeList
and it only contains a single value, it sets
Remarks
Though a bit complex, this method can be very important for functions that require single values as inputs rather than nodelists since function composition is possible (e.g. min(max(@,0),10)
) and functions return nodelists.
TryGetSingleValue(this NodeList nodeList, out JsonNode value)
Ensures a Json.Path.NodeList only represents a single value.
Declaration
1
public static bool TryGetSingleValue(this NodeList nodeList, out JsonNode value)
Parameter | Type | Description |
---|---|---|
nodeList | NodeList | Â |
value | out JsonNode | Â |
Returns
Within the context of this library, a Json.Path.NodeList may be stored inside a System.Text.Json.Nodes.JsonNode. Some operations, such as expression addition, require that a single value is provided.
This method checks to see if the underlying value of a JsonNode
is a NodeList
. If not, it simply setsNodeList
and it only contains a single value, it sets
Remarks
Though a bit complex, this method can be very important for functions that require single values as inputs rather than nodelists since function composition is possible (e.g. min(max(@,0),10)
) and functions return nodelists.
TryGetValue(this JsonNode node, out T value)
Declaration
1
public static bool TryGetValue(this JsonNode node, out T value)