Menu

JSONArray

Elvedin Hamzagic

Represents an ordered collection of values.

Implements interface IEnumerable<JSONValue>.

  • Contructors
Definition Description
public JSONArray(Object[] data) Creates JSONArray instance by assigning values from an array of Objects.
public JSONArray(IEnumerable data) Creates JSONArray instance by assigning values from any type that implements interface IEnumerable.
  • Properties
Definition Description
public Int32 Count Gets the number of items in this instance of JSONArray.
public JSONValue this[int index] Gets or sets value at position with specified index. If gets and key doesn't exists, null value will be returned, if sets and the key doesn't exists, new key will be added and value assigned to it.
  • Methods
Definition Description
public IEnumerator<JSONValue> GetEnumerator() Returns an enumerator that iterates through JSONArray.
public JSONValue Add(Object data) Adds an object to the end of the collection.
public JSONValue Insert(Object data, Int32 index) Inserts an object at the position with specified index. All following values will be moved one position forward.
public JSONValue Remove(JSONValue data) Removes an JSONValue from the collection. Note that the only reference to some value in JSON array is index. JSONValue must explicitly be constructed before adding it into collection if you want to keep reference to it. That because collection keeps reference to Object, not JSONValue, and JSONValue is created on-the-fly when accessing some value.
public JSONValue RemoveAt(int index) Removes value with the specified index from the collection.
public override String ToString() Overrides ToString method and returns JSON string representation of this instance.
public static JSONArray Parse(String data) Parses JSON string and returns newly created JSONArray instance, or null if input string is not a valid JSON.
  • Operators
Definition Description
public static implicit operator String(JSONArray data) Creates string representation of JSONArray by calling ToString method.
public static implicit operator JSONArray(String value) Creates JSONArray from JSON string by calling Parse method.

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.