Previous Topic

Next Topic

JSONPop - MaxBasic Function

JSONPop(JSONArray: Object): Object

Takes a JSON Array and removes and returns the last element of the array.

JSONPop function has these named arguments:

Parameter

Description

JSON Array

Required. A JSON Object to remove and return the last element of.

The following sample code creates a JSON object based on IN Invoice Data, then creates a JSON Array. It adds two elements to the JSON Array, then uses the JSONPop function to remove the last Element and return it as JSON2. It then prints the JSON2 object, and 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")

Dim JSON2 as Object

JSON2 = JSONPop(JsonArray)

Print JSONStringify(JSON2)

Print JSONStringify(JsonArray)

See Also

Web Functions

Book Contents

Book Index