Class JsonArray
A JSON array containing JsonValues.
public class JsonArray : JsonValue, ICloneable, IEnumerable<JsonValue>, ICollection, IEnumerable
- Inheritance
-
JsonArray
- Implements
- Derived
- Inherited Members
Constructors
JsonArray()
Creates a new, mutable JsonArray.
public JsonArray()
JsonArray(IEnumerable<string>)
Creates a new JsonArray initialized with the given string array.
public JsonArray(IEnumerable<string> vsValues)
Parameters
vsValuesIEnumerable<string>Collection of strings that will be added to the newly created array.
JsonArray(IList<JsonValue>)
Creates a new JsonArray using a given collection.
public JsonArray(IList<JsonValue> aValue)
Parameters
aValueIList<JsonValue>Collection of values. This must not be
null. If this collection is read-only then methods like Add(JsonValue) will not work.
Properties
Count
public int Count { get; }
Property Value
Value
public IList<JsonValue> Value { get; }
Property Value
Methods
Add(JsonValue)
Add another JSON data element to the end of this array.
public void Add(JsonValue aValue)
Parameters
aValueJsonValue
AddRange(IEnumerable<JsonValue>)
public void AddRange(IEnumerable<JsonValue> vJsonValues)
Parameters
vJsonValuesIEnumerable<JsonValue>
OnAfterParseArray()
This is called by the JSON parser after this array object was fully parsed. It can be used as a hook to validate the data, or to prepare a cache.
protected virtual void OnAfterParseArray()
Remarks
The default implementation does nothing.
OnCreateChildArray(int)
This is called whenever the JSON parser needs a child array object for this object.
protected virtual JsonArray OnCreateChildArray(int nIndex)
Parameters
nIndexintThe index position at which a child array object is needed.
Returns
Remarks
An override can use this as an opportunity to returned a more specific object, derived from JsonArray. Such a derived object could provide additional convenient properties for accessing the fields of it.
The default implementation just returns a new JsonArray.
OnCreateChildObject(int)
This is called whenever the JSON parser needs a child object for this array.
protected virtual JsonObject OnCreateChildObject(int nIndex)
Parameters
nIndexintThe index position at which a child object is needed.
Returns
Remarks
An override can use this as an opportunity to returned a more specific object, derived from JsonObject. Such a derived object could provide additional convenient properties for accessing the fields of it.
The default implementation just returns a new JsonObject.
Parse(byte[])
public static JsonArray Parse(byte[] vbJson)
Parameters
vbJsonbyte[]
Returns
Parse(string)
public static JsonArray Parse(string sJson)
Parameters
sJsonstring
Returns
ParseJson(byte[])
Parse the given vbJson data, adding all its objects and values
to this array.
public void ParseJson(byte[] vbJson)
Parameters
vbJsonbyte[]The JSON to be parsed. If this is is
null, then this method does nothing.
ParseJson(string)
Parse the given sJson string, adding all its objects and values
to this array.
public void ParseJson(string sJson)
Parameters
sJsonstringThe JSON to be parsed. If this is is
nullor an empty string, then this method does nothing.
Remarks
This JsonArray will receive all the parsed object. The object will be added to this array.
ToArray<T>()
public T[] ToArray<T>() where T : JsonValue
Returns
- T[]
Type Parameters
T
ToStringArray()
public string[] ToStringArray()
Returns
- string[]