JSONUnShift(JSONArray: Object, Value: Variant): Number
Takes a JSON Array and adds the Value item to the beginning of the Array, then returns the Array Length.
JSONUnShift function has these named arguments:
Parameter |
Description |
JSON Array |
Required. The JSON Array to add to. |
Value |
Required. The Value to be added to the start of the JSON Array. |
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 JSONUnShift function to add a new element to the beginning of the array, then prints the ArrayLength returned.
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 ArrayLength as Number
ArrayLength = JSONUnShift(JsonArray, "Chester:3")
Print ArrayLength