Caution
If you pass a parent but fail to add this new node to the parent's Children
collection, bad things will likely happen.
public JsonNode(
JsonNode? parent,
JsonNodeUnexpectedDuplicateSiblingReaction unexpectedDuplicateSiblingReaction
)Note that if this is not to be the root node of a new DOM (i.e. if parent is not null), even though the calling code has passed in parent, it is nevertheless still the caller's responsibility to add this node to the Children collection of the parent JsonNode, because only the calling code can know whether there is any significance to the order in which the children are arranged (see Children).
Note also that although not technically strictly necessary, in most circumstances you should intend for every node in your DOM to be constructed using the same unexpectedDuplicateSiblingReaction value. Indeed should you find yourself tempted to use varying values for this parameter across your DOM, I would caution you to be alert for the possibility that this could be symptomatic of a design issue somewhere.