Skip to main content

JArray Class

NuGet: GHIElectronics.TinyCLR.Data.Json
Assembly: GHIElectronics.TinyCLR.Data.Json
Namespace: GHIElectronics.TinyCLR.Data.Json

A JSON array — an ordered sequence of JToken elements.

public class JArray : JToken

Constructors

JArray()

public JArray()

Initializes a new empty JSON array.

JArray(JToken[] values)

public JArray(JToken[] values)

Initializes a new JSON array containing the given elements.

Properties

Length

public int Length { get; }

Gets the number of elements in the array.

Items

public JToken[] Items { get; }

Gets the array elements.

i]

public JToken this[int i] { get; }

Gets the element at the given index.

Methods

Serialize(Type type, object oSource, JsonSerializerSettings settings)

public static JArray Serialize(Type type, object oSource, JsonSerializerSettings settings = null)

Serializes a .NET array into a JSON array.

Returns JArray

ToString()

public override string ToString()

Returns the JSON text for this array.

Returns string

ToString(JsonSerializationOptions options)

public override string ToString(JsonSerializationOptions options)

Returns the JSON text for this array using the given formatting options.

Returns string

GetBsonSize()

public override int GetBsonSize()

Gets the number of bytes this array occupies when encoded as BSON.

Returns int

GetBsonSize(string ename)

public override int GetBsonSize(string ename)

Gets the number of BSON bytes for this array including the given element name.

Returns int

ToBson(byte[] buffer, ref int offset)

public override void ToBson(byte[] buffer, ref int offset)

Writes this array to the buffer as BSON, advancing the offset.

GetBsonType()

public override BsonTypes GetBsonType()

Gets the BSON type code for an array.

Returns BsonTypes