Previous Topic

Next Topic

JSONShift - MaxBasic Function

JSONShift(JSONArray: Object): Object

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

JSONShift function has these named arguments:

Parameter

Description

JSON Array

Required. The JSON Array to remove and return the first 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 JSONShift function to remove the first 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 = JSONShift(JSONArray)

Print JSONStringify(JSON2)

Print JSONStringify(JsonArray)

See Also

Web Functions

Book Contents

Book Index