Represents a JSON array, interpreted as a list of JsonValue elements.
Use the ToString or WriteTo methods to convert it to JSON.
See the Remarks section for details.
See the Remarks section for details.
Inheritance Hierarchy
KGySoft.JsonJsonArray
Namespace: KGySoft.Json
Assembly: KGySoft.Json (in KGySoft.Json.dll) Version: 2.0.1
Syntax
[SerializableAttribute] public sealed class JsonArray : IList<JsonValue>, ICollection<JsonValue>, IEnumerable<JsonValue>, IEnumerable
The JsonArray type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | JsonArray |
Initializes a new instance of the JsonArray class.
|
![]() | JsonArray(IEnumerableJsonValue) |
Initializes a new instance of the JsonArray class from a collection of JsonValue items.
|
Properties
Name | Description | |
---|---|---|
![]() | Item |
Gets or sets the element at the specified index.
When the indexer is read, using an invalid index returns Undefined, just like in JavaScript.
|
![]() | Length |
Gets the number of elements contained in the JsonArray.
|
Methods
Name | Description | |
---|---|---|
![]() | Add |
Adds an item to the JsonArray.
|
![]() | Clear |
Removes all items from the JsonArray.
|
![]() | Contains |
Determines whether the JsonArray contains the specific item.
|
![]() | CopyTo | |
![]() | Equals |
Determines whether the specified Object is equal to this instance. This method performs a deep comparison.
Allows comparing also to JsonValue instances with Array Type.
(Overrides ObjectEquals(Object).) |
![]() | GetEnumerator |
Returns an enumerator that iterates through the JsonArray.
|
![]() | GetHashCode |
Returns a hash code for this JsonArray instance.
(Overrides ObjectGetHashCode.) |
![]() | IndexOf |
Determines the index of a specific value in the JsonArray.
|
![]() | Insert |
Inserts an item to the JsonArray at the specified index.
|
![]() ![]() | Parse(String) |
Reads a JsonArray from a string that contains JSON array.
|
![]() ![]() | Parse(TextReader) |
Reads a JsonArray from a TextReader that contains a JSON array.
|
![]() ![]() | Parse(Stream, Encoding) |
Reads a JsonArray from a Stream that contains JSON array.
|
![]() | Remove |
Removes the first occurrence of the specific item from the JsonArray.
|
![]() | RemoveAt |
Removes the value from the JsonArray at the specified index.
|
![]() | ToString |
Returns a minimized JSON string that represents this JsonArray.
(Overrides ObjectToString.) |
![]() | ToString(String) |
Returns a JSON string that represents this JsonArray.
|
![]() ![]() | TryParse(String, JsonArray) |
Tries to read a JsonArray from a string that contains JSON array.
|
![]() ![]() | TryParse(TextReader, JsonArray) |
Tries to read a JsonArray from a TextReader that contains JSON array.
|
![]() ![]() | TryParse(Stream, JsonArray, Encoding) |
Tries to read a JsonArray from a Stream that contains JSON array.
|
![]() | WriteTo(StringBuilder, String) |
Writes this JsonArray instance into a JsonArray.
|
![]() | WriteTo(TextWriter, String) |
Writes this JsonArray instance into a TextReader.
|
![]() | WriteTo(Stream, Encoding, String) |
Remarks
Just like in JavaScript, the ToString (and WriteTo) methods replace Undefined values with Null.
Obtaining an element by the indexer using an invalid index returns Undefined, which is also a JavaScript-compatible behavior.
![]() |
---|
See the Remarks section of the JsonValue type for more details and examples. |
See Also