MutableJsonValue
Namespace: SnowBank.Data.Json · class
Implements: IJsonProxyNode, IJsonSerializable, IJsonPackable, IEnumerable<MutableJsonValue>, IEnumerable, IEquatable<JsonValue>, IEquatable<MutableJsonValue>, IEquatable<ObservableJsonValue>, IFormattable, ISpanFormattable, IUtf8SpanFormattable
Mutable JSON Object
Constructors
MutableJsonValue
MutableJsonValue(IMutableJsonContext ctx, MutableJsonValue parent, JsonPathSegment segment, JsonValue json)
Constructs a MutableJsonValue
ctx— Tracking context (optional)parent— Parent of this value (ornullif root)segment— Path from the parent to this node (or Empty if root)json— Value of this node
Properties
Count
int Count { get; }
Number of fields in this object
Item
MutableJsonValue Item { get; }
MutableJsonValue Item { get; }
MutableJsonValue Item { get; }
MutableJsonValue Item { get; }
MutableJsonValue Item { get; }
Keys
ICollection<string> Keys { get; }
Returns the list of keys on this object
Type
JsonType Type { get; }
Type of JSON value wrapped by this node
Methods
Add
void Add(JsonValue value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(JsonNull value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(bool value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(int value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(long value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(float value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(double value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(string value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(Guid value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(Uuid128 value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(DateTime value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(DateTimeOffset value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(Instant value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(DateOnly value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(TimeSpan value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(Duration value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(TimeOnly value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(JsonObject value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(JsonArray value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(MutableJsonValue value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(ObservableJsonValue value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add<TValue>(TValue value)
Appends a new value at the end of this array
value— Value of the new item
If the current element is null or missing, it will automatically be promoted to an array with value as its single element.
void Add(string name, JsonValue value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(string name, JsonNull value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(string name, JsonObject value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(string name, JsonArray value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(string name, MutableJsonValue value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(string name, ObservableJsonValue value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add<TValue>(string name, TValue value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(ReadOnlyMemory<char> name, JsonValue value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(ReadOnlyMemory<char> name, JsonNull value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(ReadOnlyMemory<char> name, JsonObject value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(ReadOnlyMemory<char> name, JsonArray value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(ReadOnlyMemory<char> name, MutableJsonValue value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add(ReadOnlyMemory<char> name, ObservableJsonValue value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
void Add<TValue>(ReadOnlyMemory<char> name, TValue value)
Adds a new field to the object
name— Name of the fieldvalue— Value of the field
If the current value is null or missing, it will automatically be promoted to an empty object.
ApplyPatch
void ApplyPatch(JsonObject patch, bool deepCopy = false)
Applies a patch to the current instance
patch— Patch that describes how this node should be modified.deepCopy— Iffalse(default) the content ofpatchare added by reference. Iftrue, a copy is made before being added to the current node.
As
TValue As<TValue>(TValue defaultValue = null)
Converts the optional value of this node into an instance of type TValue
defaultValue— Value returned if this node is either null or missing
Returns: Converted value, or defaultValue if the node is null or missing
Clear
void Clear()
Clears the contents of this object or array
CompareExchange
bool CompareExchange<TValue>(TValue value, TValue comparand)
Replaces the value of this node, it is equal to an expected value
value— New value for this node if the comparison succeedscomparand— Expected current value of this node
Returns: Previous value of this node
If the previous value of this node is equal to comparand, then it will be replaced with value; otherwise, it will not be modified.
To test if the object was changed, test if the returned value is equal to comparand (no change) or not (changed)
ContainsKey
bool ContainsKey(string name)
Tests if this document contains a field with the given name
name— Name of the field
Returns: true if the field is present; otherwise, false
bool ContainsKey(ReadOnlyMemory<char> name)
Tests if this document contains a field with the given name
name— Name of the field
Returns: true if the field is present; otherwise, false
bool ContainsKey(ReadOnlySpan<char> name)
Tests if this document contains a field with the given name
name— Name of the field
Returns: true if the field is present; otherwise, false
ContainsValue
bool ContainsValue(JsonValue value)
Tests if this document contains the given value
value— Value to search
Returns: true if the document is an object with a field that has this value, or an array with an item equal to this value; otherwise, false.
Equals
bool Equals(object obj)
bool Equals(MutableJsonValue other)
bool Equals(ObservableJsonValue other)
bool Equals(JsonValue other)
Exchange
JsonValue Exchange(JsonValue value)
Replaces the value of this node
value— New value for this node
Returns: Previous value of this node
If the object is already equal to , it will not be changed.
TValue Exchange<TValue>(TValue value)
Replaces the value of this node
value— New value for this node
Returns: Previous value of this node
If the object is already equal to , it will not be changed.
JsonValue Exchange(string name, JsonValue value)
Replaces the value of field of this object
name— Name of the field to updatevalue— New value for this node
Returns: Previous value of this field
If the field is already equal to , the object will not be changed.
JsonValue Exchange(int index, JsonValue value)
Replaces the value of an item of this array
index— Index of the item to updatevalue— New value for this item
Returns: Previous value of this item
If the item is already equal to , the array will not be changed.
JsonValue Exchange(Index index, JsonValue value)
Replaces the value of an item of this array
index— Index of the item to updatevalue— New value for this item
Returns: Previous value of this item
If the item is already equal to , the array will not be changed.
TValue Exchange<TValue>(string name, TValue value)
Replaces the value of field of this object
name— Name of the field to updatevalue— New value for this node
Returns: Previous value of this field
If the field is already equal to , the object will not be changed.
TValue Exchange<TValue>(int index, TValue value)
Replaces the value of an item of this array
index— Index of the item to updatevalue— New value for this item
Returns: Previous value of this item
If the item is already equal to , the array will not be changed.
TValue Exchange<TValue>(Index index, TValue value)
Replaces the value of an item of this array
index— Index of the item to updatevalue— New value for this item
Returns: Previous value of this item
If the item is already equal to , the array will not be changed.
Exists
bool Exists()
Tests if the value of this node is not null or missing
Get
MutableJsonValue Get(string name)
Returns the value of the field with the specified name
TValue Get<TValue>(string name)
Returns the value of the field with the specified name
MutableJsonValue Get(ReadOnlyMemory<char> name)
Returns the value of the field with the specified name
TValue Get<TValue>(ReadOnlyMemory<char> name)
Returns the value of the field with the specified name
MutableJsonValue Get(int index)
Returns the value of the element at the specified location
TValue Get<TValue>(int index)
Returns the value of the element at the specified location
MutableJsonValue Get(Index index)
Returns the value of the element at the specified location
TValue Get<TValue>(Index index)
Returns the value of the element at the specified location
MutableJsonValue Get(JsonPath path)
Returns the value of the child at the specified path
TValue Get<TValue>(JsonPath path)
Returns the value of the child at the specified path
MutableJsonValue Get(JsonPathSegment segment)
Returns the value of the child with the given name or index
TValue Get<TValue>(JsonPathSegment segment)
Returns the value of the child with the given name or index
TValue Get<TValue>(string name, TValue defaultValue)
Returns the value of the field with the specified name
TValue Get<TValue>(ReadOnlyMemory<char> name, TValue defaultValue)
Returns the value of the field with the specified name
TValue Get<TValue>(int index, TValue defaultValue)
Returns the value of the element at the specified location
TValue Get<TValue>(Index index, TValue defaultValue)
Returns the value of the element at the specified location
TValue Get<TValue>(JsonPath path, TValue defaultValue)
Returns the value of the child at the specified path
TValue Get<TValue>(JsonPathSegment segment, TValue defaultValue)
Returns the value of the child with the given name or index
GetContext
IMutableJsonContext GetContext()
Returns the tracking context that is attached to this node
GetDepth
int GetDepth()
Returns the number of nodes between the root and this node
GetEnumerator
IEnumerator<MutableJsonValue> GetEnumerator()
GetHashCode
int GetHashCode()
GetOrCreateArray
MutableJsonValue GetOrCreateArray(string name)
Returns the array in the field with the given name
name— Name of the field
Returns: Existing array, or a newly created array if the field was null or missing
MutableJsonValue GetOrCreateArray(ReadOnlyMemory<char> name)
Returns the array in the field with the given name
name— Name of the field
Returns: Existing array, or a newly created array if the field was null or missing
MutableJsonValue GetOrCreateArray(int index)
Returns the array in the item at the given location
index— Index of the item
Returns: Existing array, or a newly created array if the field was null or missing
MutableJsonValue GetOrCreateArray(Index index)
Returns the array in the item at the given location
index— Index of the item
Returns: Existing array, or a newly created array if the field was null or missing
GetOrCreateObject
MutableJsonValue GetOrCreateObject(string name)
Returns the object in the field with the given name
name— Name of the field
Returns: Existing object, or a newly created object if the field was null or missing
MutableJsonValue GetOrCreateObject(ReadOnlyMemory<char> name)
Returns the object in the field with the given name
name— Name of the field
Returns: Existing object, or a newly created object if the field was null or missing
MutableJsonValue GetOrCreateObject(int index)
Returns the object in the item at the given location
index— Index of the item
Returns: Existing object, or a newly created object if the field was null or missing
MutableJsonValue GetOrCreateObject(Index index)
Returns the object in the item at the given location
index— Index of the item
Returns: Existing object, or a newly created object if the field was null or missing
GetParent
MutableJsonValue GetParent()
Returns the parent of this node
Returns: Parent node, or null if root
GetPath
JsonPath GetPath()
Returns the path to this node, from the root
JsonPath GetPath(JsonPathSegment child)
Returns the path to a child of this value, from the root
GetValue
JsonValue GetValue(string name)
Returns the underlying JSON value of the field with the specified name
JsonValue GetValue(ReadOnlyMemory<char> name)
Returns the underlying JSON value of the field with the specified name
JsonValue GetValue(int index)
Returns the underlying JSON value of the element at the specified location
JsonValue GetValue(Index index)
Returns the underlying JSON value of the element at the specified location
JsonValue GetValue(JsonPath path)
Returns the underlying JSON value of the child at the specified path
JsonValue GetValue(JsonPathSegment segment)
Returns the value of the child with the given name or index
Increment
void Increment()
Increments the value of this node
If the node is null or missing, it will be set to 1
MutableJsonValue Increment(string name)
Increments the value of a field of this object
If the field is null or missing, it will be set to 1
MutableJsonValue Increment(int index)
Increments the value of an item of this object
If the item is null or missing, it will be set to 1
MutableJsonValue Increment(Index index)
Increments the value of an item of this object
If the item is null or missing, it will be set to 1
Insert
void Insert(int index, JsonValue value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, JsonNull value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, bool value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, int value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, long value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, float value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, double value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, string value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, Guid value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, Uuid128 value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, DateTime value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, DateTimeOffset value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, Instant value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, DateOnly value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, TimeSpan value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, Duration value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, TimeOnly value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, JsonObject value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, JsonArray value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, MutableJsonValue value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(int index, ObservableJsonValue value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert<TValue>(int index, TValue value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, JsonValue value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, JsonNull value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, bool value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, int value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, long value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, float value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, double value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, string value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, Guid value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, Uuid128 value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, DateTime value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, DateTimeOffset value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, Instant value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, DateOnly value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, TimeSpan value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, Duration value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, TimeOnly value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, JsonObject value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, JsonArray value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, MutableJsonValue value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert(Index index, ObservableJsonValue value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert<TValue>(Index index, TValue value)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insert
void Insert<TValue>(int index, TValue value, IJsonPacker<TValue> converter)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insertconverter— Converter used to unpack the JSON value into aTValueinstance
void Insert<TValue>(Index index, TValue value, IJsonPacker<TValue> converter)
Inserts a new value at the specified index of this array
index— Index where the value should be insertedvalue— Value to insertconverter— Converter used to unpack the JSON value into aTValueinstance
IsArray
bool IsArray()
Tests if the wrapped JSON value is a non-null array.
Returns: true if the value is an array; otherwise, false
This method will record a access.
IsArrayOrMissing
bool IsArrayOrMissing()
Tests if the wrapped JSON value is either an array, or null-or-missing.
Returns: true if the value is an array, null or missing; otherwise, false
This method will record a access.
IsArrayUnsafe
bool IsArrayUnsafe(out JsonArray value)
Tests if the wrapped JSON value is a non-null array.
value— Receives the underlying JSON array
Returns: true if the value is an array; otherwise, false
This method will record a Type access, but any reads performed on value will not be tracked by the attached context!
It is intended to be used by infrastructure code that will manually record any access to the value.
IsNullOrMissing
bool IsNullOrMissing()
Tests if the node has no value (null or missing)
IsObject
bool IsObject()
Tests if the wrapped JSON value is a non-null object.
Returns: true if the value is an object; otherwise, false
This method will record a access.
IsObjectOrMissing
bool IsObjectOrMissing()
Tests if the wrapped JSON value is either an object, or null-or-missing.
Returns: true if the value is an object, null or missing; otherwise, false
This method will record a access.
IsObjectUnsafe
bool IsObjectUnsafe(out JsonObject value)
Tests if the wrapped JSON value is a non-null object.
value— Receives the underlying JSON object
Returns: true if the value is an object; otherwise, false
This method will record a Type access, but any reads performed on value will not be tracked by the attached context!
It is intended to be used by infrastructure code that will manually record any access to the value.
IsOfType
bool IsOfType(JsonType type)
Tests if the wrapped JSON value is of the given type
type— Expected type of the value
Returns: true if the value is of this type; otherwise, false
This method will record a access.
IsOfTypeOrNull
bool IsOfTypeOrNull(JsonType type)
Tests if the wrapped JSON value is of the given type, or is null-or-missing
type— Expected type of the value
Returns: true if the value is of this type, null or missing; otherwise, false
This method will record a access.
IsRoot
bool IsRoot()
Tests if this is the top-level node of the document
Remove
bool Remove()
Removes this node from its parent
bool Remove(string name)
Removes a field from this node
bool Remove(ReadOnlyMemory<char> name)
Removes a field from this node
bool Remove(JsonPathSegment segment)
Removes the specified child from this node
bool Remove(JsonPath path)
Removes the child at the specified path
bool Remove(string name, out JsonValue value)
Removes a field from this node
bool Remove(ReadOnlyMemory<char> name, out JsonValue value)
Removes a field from this node
RemoveAt
bool RemoveAt(int index)
Removes the element at the specified index from this node
bool RemoveAt(Index index)
Removes the element at the specified index from this node
bool RemoveAt(int index, out JsonValue value)
Removes the element at the specified index from this node
bool RemoveAt(Index index, out JsonValue value)
Removes the element at the specified index from this node
Required
TValue Required<TValue>()
Converts the required value of this node into an instance of type TValue
Returns: Converter value
Set
void Set(JsonValue value)
Changes the value of the current instance in its parent
value— New value for this element
If the current element is a field of an object, the field will either be added or updated in the parent object.
If the current element is an index in an array, the entry will be set to the new value. If the array was smaller, it will automatically be expanded, and any gaps will be filled with null values.
void Set(JsonObject value)
Changes the value of the current instance in its parent
value— New value for this element
void Set(JsonArray value)
Changes the value of the current instance in its parent
value— New value for this element
void Set(MutableJsonValue value)
Changes the value of the current instance in its parent
value— New value for this element
void Set(ObservableJsonValue value)
Changes the value of the current instance in its parent
value— New value for this element
This will we recorded as a full use of
void Set<TValue>(TValue value)
Changes the value of the current instance in its parent
value— New value for this element
void Set(bool value)
Changes the value of the current instance in its parent
void Set(int value)
Changes the value of the current instance in its parent
void Set(uint value)
Changes the value of the current instance in its parent
void Set(long value)
Changes the value of the current instance in its parent
void Set(ulong value)
Changes the value of the current instance in its parent
void Set(float value)
Changes the value of the current instance in its parent
void Set(double value)
Changes the value of the current instance in its parent
void Set(decimal value)
Changes the value of the current instance in its parent
void Set(Half value)
Changes the value of the current instance in its parent
void Set(Int128 value)
Changes the value of the current instance in its parent
void Set(UInt128 value)
Changes the value of the current instance in its parent
void Set(string value)
Changes the value of the current instance in its parent
void Set(DateTime value)
Changes the value of the current instance in its parent
void Set(DateTimeOffset value)
Changes the value of the current instance in its parent
void Set(Instant value)
Changes the value of the current instance in its parent
void Set(DateOnly value)
Changes the value of the current instance in its parent
void Set(TimeSpan value)
Changes the value of the current instance in its parent
void Set(Duration value)
Changes the value of the current instance in its parent
void Set(TimeOnly value)
Changes the value of the current instance in its parent
void Set<TValue>(TValue value, IJsonPacker<TValue> converter)
Changes the value of the current instance in its parent
value— New value for this elementconverter— Converter used to unpack the JSON value into aTValueinstance
void Set(string name, JsonValue value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, JsonObject value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, JsonArray value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, MutableJsonValue value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, ObservableJsonValue value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set<TValue>(string name, TValue value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, bool value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, int value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, uint value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, long value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, ulong value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, float value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, double value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, decimal value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, Half value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, Int128 value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, UInt128 value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, string value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, Guid value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, Uuid128 value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, DateTime value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, DateTimeOffset value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, Instant value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, DateOnly value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, TimeSpan value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, Duration value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(string name, TimeOnly value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, JsonValue value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, JsonObject value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, JsonArray value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, MutableJsonValue value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, ObservableJsonValue value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set<TValue>(ReadOnlyMemory<char> name, TValue value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, bool value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, int value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, uint value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, long value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, ulong value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, float value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, double value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, decimal value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, Half value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, Int128 value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, UInt128 value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, string value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, Guid value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, Uuid128 value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, DateTime value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, DateTimeOffset value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, Instant value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, DateOnly value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, TimeSpan value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, Duration value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(ReadOnlyMemory<char> name, TimeOnly value)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set(JsonPath path, JsonValue value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(JsonPath path, JsonNull value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(JsonPath path, JsonBoolean value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(JsonPath path, JsonNumber value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(JsonPath path, JsonString value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(JsonPath path, JsonDateTime value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(JsonPath path, JsonObject value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(JsonPath path, JsonArray value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(JsonPath path, MutableJsonValue value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(JsonPath path, ObservableJsonValue value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set<TValue>(JsonPath path, TValue value)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set(int index, JsonValue value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, JsonNull value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, bool value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, int value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, long value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, float value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, double value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, string value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, Guid value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, Uuid128 value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, DateTime value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, DateTimeOffset value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, Instant value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, DateOnly value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, TimeSpan value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, Duration value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, TimeOnly value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, JsonObject value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, JsonArray value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, MutableJsonValue value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(int index, ObservableJsonValue value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set<TValue>(int index, TValue value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, JsonValue value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, JsonNull value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, bool value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, int value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, long value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, float value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, double value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, string value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, Guid value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, Uuid128 value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, DateTime value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, DateTimeOffset value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, Instant value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, DateOnly value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, TimeSpan value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, Duration value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, TimeOnly value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, JsonObject value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, JsonArray value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, MutableJsonValue value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set(Index index, ObservableJsonValue value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set<TValue>(Index index, TValue value)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set<TValue>(string name, TValue value, IJsonPacker<TValue> converter)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set<TValue>(ReadOnlyMemory<char> name, TValue value, IJsonPacker<TValue> converter)
Sets or changes the value of the field with the given name
name— Name of the fieldvalue— New value for this field
If the current element is null or missing in its parent, it will automatically be created as a new object.
void Set<TValue>(JsonPath path, TValue value, IJsonPacker<TValue> converter)
Sets or changes the value of the child at the given path
path— Path to the childvalue— New value for this child
If any descendant between the current node and the child is either null or missing, it will automatically be created as either a new object or array, as determined by the path.
void Set<TValue>(int index, TValue value, IJsonPacker<TValue> converter)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
void Set<TValue>(Index index, TValue value, IJsonPacker<TValue> converter)
Sets or changes the value of the item at the given location
index— Index of the itemvalue— New value for this item
If the current element is null or missing in its parent, it will automatically be created as a new array.
ToJson
JsonValue ToJson()
Returns the JsonValue tracked by this node
ToJsonValue
JsonValue ToJsonValue()
Returns the JsonValue tracked by this node
ToString
string ToString()
string ToString(string format, IFormatProvider provider = null)
Tracked
static MutableJsonValue Tracked(IMutableJsonContext tr, JsonValue value)
Returns a mutable JSON value tracked by a transaction
TryAdd
bool TryAdd(string name, JsonValue value)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd(string name, MutableJsonValue value)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add.
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd(string name, ObservableJsonValue value)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add.
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd<TValue>(string name, TValue value)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add.
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd(ReadOnlyMemory<char> name, JsonValue value)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add.
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd(ReadOnlyMemory<char> name, MutableJsonValue value)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add.
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd(ReadOnlyMemory<char> name, ObservableJsonValue value)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add.
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd<TValue>(ReadOnlyMemory<char> name, TValue value)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add.
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd(JsonPath path, JsonValue value)
Adds a new node to this document, if it does not already exist
path— Path to the nodevalue— Value to add.
Returns: true if the node was added, or false if there was already a node at this location (the document will not be modified)
bool TryAdd(JsonPath path, MutableJsonValue value)
Adds a new node to this document, if it does not already exist
path— Path to the nodevalue— Value to add.
Returns: true if the node was added, or false if there was already a node at this location (the document will not be modified)
bool TryAdd(JsonPath path, ObservableJsonValue value)
Adds a new node to this document, if it does not already exist
path— Path to the nodevalue— Value to add.
Returns: true if the node was added, or false if there was already a node at this location (the document will not be modified)
bool TryAdd<TValue>(JsonPath path, TValue value)
Adds a new node to this document, if it does not already exist
path— Path to the nodevalue— Value to add.
Returns: true if the node was added, or false if there was already a node at this location (the document will not be modified)
bool TryAdd<TValue>(string name, TValue value, IJsonPacker<TValue> converter)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add.converter— Custom JSON converter
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd<TValue>(ReadOnlyMemory<char> name, TValue value, IJsonPacker<TValue> converter)
Adds a new field to this object, if it does not already exist
name— Name of the fieldvalue— Value to add.converter— Custom JSON converter
Returns: true if the field was added, or false if there was already a field with this name (the object will not be modified)
bool TryAdd<TValue>(JsonPath path, TValue value, IJsonPacker<TValue> converter)
Adds a new node to this document, if it does not already exist
path— Path to the nodevalue— Value to add.converter— Custom JSON packer
Returns: true if the node was added, or false if there was already a node at this location (the document will not be modified)
TryFormat
bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider)
bool TryFormat(Span<byte> destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider provider)
TryGetValue
bool TryGetValue(string key, out MutableJsonValue value)
Returns the value of the field with the given name, if it is not null or missing
key— Name of the field in this objectvalue— Value that represents this field in the current object.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (!root.TryGetValue("Error", out var error))
{ // this is the first error, will automatically create a new 'Error' object
error["Attempts"] = 1;
error["FirstAttempt"] = DateTimeOffset.UtcNow;
// root will now have { ..., "Error": { "Attempts": 1, "FirstAttempt": "..." } }
}
else
{ // there was already an 'Error' object, record the new attempt
error["Attempts"].Increment();
error["LastAttempt"] = DateTimeOffset.UtcNow;
// root will now have { ..., "Error": { "Attempts": (+1), "FirstAttempt": "...", "LastAttempt": "...", ... } }
}
bool TryGetValue<TValue>(string key, out TValue value)
Returns the value of the field with the given name, if it is not null or missing
key— Name of the field in this objectvalue— Value that represents this field in the current object.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (!foo.TryGetValue<Bar>("bar", out var bar))
{ // first time
bar = new Bar { /* ... */ }
foo.Set("bar", bar);
}
bool TryGetValue(ReadOnlyMemory<char> key, out MutableJsonValue value)
Returns the value of the field with the given name, if it is not null or missing
key— Name of the field in this objectvalue— Value that represents this field in the current object.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (!root.TryGetValue("Error", out var error))
{ // this is the first error, will automatically create a new 'Error' object
error["Attempts"] = 1;
error["FirstAttempt"] = DateTimeOffset.UtcNow;
// root will now have { ..., "Error": { "Attempts": 1, "FirstAttempt": "...", ... } }
}
else
{ // there was already an 'Error' object, record the new attempt
error["Attempts"].Increment();
error["LastAttempt"] = DateTimeOffset.UtcNow;
// root will now have { ..., "Error": { "Attempts": (+1), "FirstAttempt": "...", "LastAttempt": "...", ... } }
}
bool TryGetValue<TValue>(ReadOnlyMemory<char> key, out TValue value)
Returns the value of the field with the given name, if it is not null or missing
key— Name of the field in this objectvalue— Value that represents this field in the current object.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (!foo.TryGetValue<Bar>("bar".AsMemory(), out var bar))
{ // first time
bar = new Bar { /* ... */ }
foo.Set("bar", bar);
}
bool TryGetValue(int index, out MutableJsonValue value)
Returns the value of the item at the given location, if it was non-null and inside the bounds of the array
index— Index of the element in this arrayvalue— Value that represents this index in the current array.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (!root["Foos"].TryGetValue(2, out var item))
{ // either Foos[] has size less than 3, or Foos[2] is null.
item["Version"] = 0;
item["Created"] = DateTimeOffset.UtcNow;
// Foos[2] will now be equal to: { "Version": 0, "Created": "..." }
}
else
{ // Foos[2] already had a non-null value
item["Version"].Increment();
item["LastModified"] = DateTimeOffset.UtcNow;
// Foos[2] will now be equal to: { "Version": (+ 1), "Created": "...", "LastModified": "...", ... }
}
bool TryGetValue<TValue>(int index, out TValue value)
Returns the value of the item at the given location, if it was non-null and inside the bounds of the array
index— Index of the element in this arrayvalue— Value that represents this index in the current array, converted intoTValue.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (root["Foos"].TryGetValue(1, out var foo))
{
ProcessFoo(foo);
}
// ...
static void ProcessFoo(Foo instance) { /* ... */ }
bool TryGetValue(Index index, out MutableJsonValue value)
Returns the value of the item at the given location, if it was non-null and inside the bounds of the array
index— Index of the element in this arrayvalue— Value that represents this index in the current array.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (!root["Foos"].TryGetValue(2, out var item))
{ // either Foos[] has size less than 3, or Foos[2] is null.
item["Version"] = 0;
item["Created"] = DateTimeOffset.UtcNow;
// Foos[2] will now be equal to: { "Version": 0, "Created": "..." }
}
else
{ // Foos[2] already had a non-null value
item["Version"].Increment();
item["LastModified"] = DateTimeOffset.UtcNow;
// Foos[2] will now be equal to: { "Version": (+ 1), "Created": "...", "LastModified": "...", ... }
}
bool TryGetValue<TValue>(Index index, out TValue value)
Returns the value of the item at the given location, if it was non-null and inside the bounds of the array
index— Index of the element in this arrayvalue— Value that represents this index in the current array, converted intoTValue.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (root["Foos"].TryGetValue(1, out var foo))
{
ProcessFoo(foo);
}
// ...
static void ProcessFoo(Foo instance) { /* ... */ }
bool TryGetValue<TValue>(string key, IJsonDeserializer<TValue> converter, out TValue value)
Returns the value of the field with the given name, if it is not null or missing
key— Name of the field in this objectconverter— Converter used to unpack the JSON value into aTValueinstancevalue— Value that represents this field in the current object.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (!foo.TryGetValue<Bar>("bar", GeneratedConverters.Bar.Default, out var bar))
{ // first time
bar = new Bar { /* ... */ }
foo.Set("bar", bar, GeneratedConverters.Bar.Default);
}
bool TryGetValue<TValue>(ReadOnlyMemory<char> key, IJsonDeserializer<TValue> converter, out TValue value)
Returns the value of the field with the given name, if it is not null or missing
key— Name of the field in this objectconverter— Converter used to unpack the JSON value into aTValueinstancevalue— Value that represents this field in the current object.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (!foo.TryGetValue<Bar>("bar".AsMemory(), GeneratedConverters.Bar.Default, out var bar))
{ // first time
bar = new Bar { /* ... */ }
foo.Set("bar", bar, GeneratedConverters.Bar.Default);
}
bool TryGetValue<TValue>(int index, IJsonDeserializer<TValue> converter, out TValue value)
Returns the value at the given location, if it was non-null and inside the bounds of the array
index— Index of the element in this arrayconverter— Converter used to unpack the JSON value into aTValueinstancevalue— Value that represents this index in the current array, converted intoTValue.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (root["Foos"].TryGetValue(1, GeneratedConverters.Foo.Default, out var foo))
{
ProcessFoo(foo);
}
// ...
static void ProcessFoo(Foo instance) { /* ... */ }
bool TryGetValue<TValue>(Index index, IJsonDeserializer<TValue> converter, out TValue value)
Returns the value of the item at the given location, if it was non-null and inside the bounds of the array
index— Index of the element in this arrayconverter— Converter used to unpack the JSON value into aTValueinstancevalue— Value that represents this index in the current array, converted intoTValue.
Returns: true if the element exists and has a non-null value; otherwise, false.
This can be used to perform a different operation if the value exists or not (initialize a counter or increment its value, throw a specialized exception, ....)
if (root["Foos"].TryGetValue(1, GeneratedConverters.Foo.Default, out var foo))
{
ProcessFoo(foo);
}
// ...
static void ProcessFoo(Foo instance) { /* ... */ }
Untracked
static MutableJsonValue Untracked(JsonValue value)
Returns an untracked mutable JSON value
ValueEquals
bool ValueEquals<TValue>(TValue value, IEqualityComparer<TValue> comparer = null)
Tests if the current node is equal to the specified value, using the strict JSON comparison semantics
value— Expected valuecomparer— Custom equality comparer if specified; otherwise, uses the default comparer for this type
Returns: true if both arguments are considered equal; otherwise, false
This method tries to perform an optimized comparison, and should perform less memory allocations than calling
bool ValueEquals<TValue>(string name, TValue value, IEqualityComparer<TValue> comparer = null)
Tests if the field with the specified name is equal to the specified value, using the strict JSON comparison semantics
name— Name of the fieldvalue— Expected valuecomparer— Custom equality comparer if specified; otherwise, uses the default comparer for this type
Returns: true if both arguments are considered equal; otherwise, false
This method tries to perform an optimized comparison, and should perform less memory allocations than calling
bool ValueEquals<TValue>(ReadOnlyMemory<char> name, TValue value, IEqualityComparer<TValue> comparer = null)
Tests if the field with the specified name is equal to the specified value, using the strict JSON comparison semantics
name— Name of the fieldvalue— Expected valuecomparer— Custom equality comparer if specified; otherwise, uses the default comparer for this type
Returns: true if both arguments are considered equal; otherwise, false
This method tries to perform an optimized comparison, and should perform less memory allocations than calling
bool ValueEquals<TValue>(int index, TValue value, IEqualityComparer<TValue> comparer = null)
Tests if the item at the specified location is equal to the specified value, using the strict JSON comparison semantics
index— Index of the itemvalue— Expected valuecomparer— Custom equality comparer if specified; otherwise, uses the default comparer for this type
Returns: true if both arguments are considered equal; otherwise, false
This method tries to perform an optimized comparison, and should perform less memory allocations than calling
bool ValueEquals<TValue>(Index index, TValue value, IEqualityComparer<TValue> comparer = null)
Tests if the item at the specified location is equal to the specified value, using the strict JSON comparison semantics
index— Index of the itemvalue— Expected valuecomparer— Custom equality comparer if specified; otherwise, uses the default comparer for this type
Returns: true if both arguments are considered equal; otherwise, false
This method tries to perform an optimized comparison, and should perform less memory allocations than calling
bool ValueEquals<TValue>(JsonPathSegment segment, TValue value, IEqualityComparer<TValue> comparer = null)
Tests if the child with the specified name or index is equal to the specified value, using the strict JSON comparison semantics
segment— Name or index of the childvalue— Expected valuecomparer— Custom equality comparer if specified; otherwise, uses the default comparer for this type
Returns: true if both arguments are considered equal; otherwise, false
This method tries to perform an optimized comparison, and should perform less memory allocations than calling
bool ValueEquals<TValue>(JsonPath path, TValue value, IEqualityComparer<TValue> comparer = null)
Tests if the child at the specified path is equal to the specified value, using the strict JSON comparison semantics
path— Path to the childvalue— Expected valuecomparer— Custom equality comparer if specified; otherwise, uses the default comparer for this type
Returns: true if both arguments are considered equal; otherwise, false
This method tries to perform an optimized comparison, and should perform less memory allocations than calling
WritePath
void WritePath(ref JsonPathBuilder sb)
Write the path from the root to this node