JsonArray Class Methods

In this section, the JsonArray class methods are presented in alphabetical order.

Syntax

AddElement(Element)

Description

Use this method to add an element of any type to the Json array.

Parameters

Field or Control

Definition

Element

Specifies the element that needs to be added as any type.

Returns

None.

Example

Local JsonArray &jArray = CreateJsonArray();
&jArray.AddElement("Name");

Syntax

AddJsonArrayElement(Name, Array)

Description

Use this method to add a Json array to the Json array.

Parameters

Field or Control

Definition

Name

Specifies the name of the Json array as a string.

Array

Specifies the array as a JsonArray.

Returns

None.

Example

Local JsonArray &jArray = CreateJsonArray();
Local JsonArray &jArr1 = CreateJsonArray();
&jArray.AddJsonArrayElement("Member Names", &jArr1);

Syntax

AddJsonObjectElement(Name, Obj)

Description

Use this method to add a Json object to the Json array.

Parameters

Field or Control

Definition

Name

Specifies the name of the Json object as a string.

Obj

Specifies the object as a JsonObject.

Returns

None.

Example

Local JsonArray &jArray = CreateJsonArray();
Local JsonObject &jArrObj = CreateJsonObject();
&jArrObj.AddProperty("Name1", "TYPE_STRING");
&jArrObj.AddProperty("Name2", "TYPE_STRING");
&jArray.AddJsonObjectElement("Member Names", &jArrObj);

Syntax

AddNullElement()

Description

Use this method to add a null element to the Json array.

Parameters

None.

Returns

None.

Example

Local JsonArray &jArray = CreateJsonArray();
&jArray.AddNullElement();

Syntax

GetAsString(Index)

Description

Use this method to return the Json array element at the index location as a string.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

String.

Example

Local JsonArray &jArray = CreateJsonArray();
Local string &myJeStr = &jArray.GetAsString(2);

Syntax

GetBoolean(Index)

Description

Use this method to return the Boolean value at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

Boolean.

Example

Local JsonArray &jArray = CreateJsonArray();
Local Boolean &myBool = &jArray.GetBoolean(2);

Syntax

GetDate(Index)

Description

Use this method to return the date at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

Date.

Example

Local JsonArray &jArray = CreateJsonArray();
Local Date &myDt = &jArray.GetDate(2);

Syntax

GetDateTime(Index)

Description

Use this method to return the date time at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

DateTime.

Example

Local JsonArray &jArray = CreateJsonArray();
Local DateTime &myDt = &jArray.GetDateTime(2);

Syntax

GetFloat(Index)

Description

Use this method to return the float value at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

Float.

Example

Local JsonArray &jArray = CreateJsonArray();
Local float &myFloat = &jArray.GetFloat(2);

Syntax

GetInteger(Index)

Description

Use this method to return the integer value at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

Integer.

Example

Local JsonArray &jArray = CreateJsonArray();
Local integer &myInt = &jArray.GetInteger(2);

Syntax

GetJsonArray(Index)

Description

Use this method to return the Json array at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

JsonArray.

Example

Local JsonArray &jArray = CreateJsonArray();
Local JsonArray &myJsonArr = &jArray.GetJsonArray(2);

Syntax

GetJsonNode(Index)

Description

Use this method to return the Json node at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

JsonNode.

Example

Local JsonArray &jArray = CreateJsonArray();
Local JsonNode &myJsonNd = &jArray.GetJsonNode(2);

Syntax

GetJsonObject(Index)

Description

Use this method to return the Json object at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

JsonObject.

Example

Local JsonArray &jArray = CreateJsonArray();
Local JsonObject &myJsonObj = &jArray.GetJsonObject(2);

Syntax

GetNumber(Index)

Description

Use this method to return the number value at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

Number.

Example

Local JsonArray &jArray = CreateJsonArray();
Local number &myNum = &jArray.GetNumber(2);

Syntax

GetString(Index)

Description

Use this method to return the string value at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

String.

Example

Local JsonArray &jArray = CreateJsonArray();
Local string &myStr = &jArray.GetString(2);

Syntax

GetTime(Index)

Description

Use this method to return the time at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

Time.

Example

Local JsonArray &jArray = CreateJsonArray();
Local Time &myTm = &jArray.GetTime(2);

Syntax

GetType(Index)

Description

Use this method to return the Json value type at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

Integer.

Example

Local JsonArray &jArray = CreateJsonArray();
Local integer &myJvTyp = &jArray.GetType(2);

Syntax

IsNull(Index)

Description

Use this method to check whether the Json array element at the index location is null.

Parameters

Field or Control

Definition

Index

Specifies the index in the Json array as an integer.

Returns

Boolean.

Example

Local JsonArray &jArray = CreateJsonArray();
Local Boolean &bIsNull = &jArray.IsNull(2);

Syntax

Length()

Description

Use this method to return the length of the Json array.

Parameters

None.

Returns

Integer.

Example

Local JsonArray &jArray = CreateJsonArray();
Local integer &myJaLen = &jArray.Length();

Syntax

Pop()

Description

Use this method to remove the last element in the Json array.

Parameters

None.

Returns

None.

Example

Local JsonArray &jArray = CreateJsonArray();
&jArray.Pop();

Syntax

Remove(Index)

Description

Use this method to remove the element at the index location.

Parameters

Field or Control

Definition

Index

Specifies the index as an integer.

Returns

None.

Example

Local JsonArray &jArray = CreateJsonArray();
&jArray.Remove(3);

Syntax

ToString()

Description

Use this method to serialize the Json array to a string.

Parameters

None.

Returns

String.

Example

Local JsonArray &jArray = CreateJsonArray();
Local string &myJaStr = &jArray.ToString();