JsonNodeItem(String) Property

Alternative to using the Children collection when the node is of type Object, that gets a child node keyed on its name. If duplicate named siblings exist, reacts as per the unexpectedDuplicateSiblingReaction parameter of the current object's constructor. If no child with the specified name exists, throws a JsonNodeMemberNotFoundException. If the node is not of type Object, throws an InvalidOperationException.

Definition

Namespace: MichaelBrooks.UK.Json
Assembly: JsonDOM (in JsonDOM.dll) Version: 1.0.7
C#
public JsonNode this[
	string name
] { get; }

Parameters

name  String
The name of the JSON object's member to be accessed.

Property Value

JsonNode

Remarks

The existence of the Children property plus this property and its indexing equivalent is a very deliberate contravention of Occam's Razor in order to simplify the calling code in most circumstances. This property and the ItemInt32 property can be used in chains to effectively support the bracketed notation form of JSONPath for navigating the parse tree. This property only supports the get operation. If you wish to add a new child node to the parent object, you must do so via the Children collection.
Online page.

Exceptions

JsonNodeDuplicateSiblingNameExceptionThrown when multiple sibling child nodes have the specified name and this JsonNode object has been configured (via the constructor) to throw an exception in this circumstance.
InvalidOperationExceptionThrown when this node is not of type Object.
JsonNodeMemberNotFoundExceptionThrown when no child node has the specified name.

See Also