Previous Topic

Next Topic

JSONPush - MaxBasic Function

JSONPush(JSONArray: Object, Value: Variant): Number

Adds the Value to a JSON Array and returns the new length of the JSON array.

JSONPush function has these named arguments:

Parameter

Description

JSON Array

Required. A JSON Array to add the Value to.

Value

Required. The Value to be added to the JSON Array.

The following sample code creates a JSON object based on IN Invoice Data, then creates a JSON Array. It uses the JSONPush function to add two elements to the JSON Array, then prints the JSONArray.

Sample code:

Dim datINInvoice as Object

datINInvoice = CreateObject("Accredo.INInvoiceData")

Dim JSON as Object

JSON = BuildJSON(datINInvoice, "CustomerCode;DocumentNo;DocumentID;Line", "Charge;Banking")

Dim JsonArray as Object

JsonArray = JSONCreateArray(JSON, "CustomerCode;DocumentNo")

JSONPush(JsonArray,"ASHENG;1")

JSONPush(JsonArray"BROWN;2")

Print JSONStringify(JsonArray)

See Also

Web Functions

Book Contents

Book Index