Previous Topic

Next Topic

JSONCreateObject - MaxBasic Function

JSONCreateObject[(RootObject: Object, ElementName: String)]: Object

Creates a JSON Object. If no parameters are passed, creates am empty JSON object. If parameters are passed, creates a nested JSON Object with the elements in the Element Name string.

JSONCreateObject function has these named arguments:

Parameter

Description

Root Object

Optional. The object to create a nested JSON Object from. Required if Element Name is passed in.

Element Name

Optional. A semi-colon delimited string containing the elements to be included. Required if the Root Object is passed in.

The following sample code creates and empty JSON object:

Dim obj1 as Object

obj1 = JSONCreateObject

The following sample code creates a JSON object based on IN Invoice Data, then creates a nested JSON Object called obj2 containing the Customer Code and Document No.

Sample code:

Dim datINInvoice as Object

datINInvoice = CreateObject("Accredo.INInvoiceData")

Dim JSON as Object

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

Dim obj2 as Object

obj2 = JSONCreateObject(JSON, "CustomerCode;DocumentNo")

See Also

Web Functions

Book Contents

Book Index