JSONPackage object

The JSONPackage object provides the ability to merge data in a JSON object or extract data from a JSON object. Merging and extracting can occur at both the client side and the server side. The resulted JSON can be posted from the client to the server via HTTPClient, or retrieved from the server to the client via RESTClient.

For the JSON string that can be loaded by the JSONPackage object, see the section called “Supported JSON formats” in Application Techniques.

Note

It is not supported to use this object to process large data (20 MB or 100,000 data rows can be considered as large data based on our tests), because this object will call a third-party library which is memory intensive.

Note

The data to be merged can be from DataWindow, DataStore, DataWindowChild, or from an existing JSON.

Composite, Crosstab, OLE 2.0, and RichText DataWindows are unsupported.

Note

JSONPackage (as well as HTTPClient, RESTClient, CrypterObject, CoderObject, CompressorObject, DotNetAssembly, JSONGenerator, JSONParser, OAuthClient, PDF Builder objects, SMTPClient, PowerServerLabel, PowerServerResult) does not support multi-threading.

Properties

JSONPackage property

Datatype

Description

IgnoreCase

Boolean

A boolean value that specifies whether to ignore the case for key.

ClassDefinition

PowerObject

An object of type PowerObject containing information about the class definition of the object or control.

ReturnsNullWhenError

Boolean

Specifies whether the getting value function returns a null value when error occurs.


Events

JSONPackage event

Occurs

Constructor

When the object is created.

Destructor

When the object is destroyed.


Functions

JSONPackage function

Datatype returned

Description

ClassName

String

Returns the name assigned to the object.

Clear

Integer

Deletes all of the keys.

ContainsKey

Boolean

Checks if the key name exists.

GetContextService

Integer

Creates a reference to a context-specific instance of the specified service.

GetJSONBlob

Blob

Gets the JSON blob data.

GetJSONString

String

Gets the JSON string data.

GetKey

String

Gets the key name.

GetParent

PowerObject

Returns a reference to the name of the parent object.

GetValue

String

Gets the value of the key.

GetValueBlob

Blob

Gets the blob value of the key.

GetValueBoolean

Boolean

Gets the boolean value of the key.

GetValueDate

Date

Gets the date value of the key.

GetValueDateTime

DateTime

Gets the datetime value of the key.

GetValueNumber

Number

Gets the number value of the key.

GetValueString

String

Gets the string value of the key.

GetValueTime

Time

Gets the time value of the key.

GetValueToDataWindow

Long

Gets the value of the key and inserts it into a DataWindow control, DataStore object, or DataWindowChild object.

KeyCount

Long

Gets the total number of keys.

LoadFile

String

Loads a JSON file.

LoadString

String

Loads a JSON string.

PostEvent

Boolean

Adds an event to the end of the message queue for the object.

Remove

Integer

Removes a key.

SaveToFile

Integer

Saves the JSON data to the local file.

SetValue

Integer

Sets the value of the key.

SetValueBlob

Integer

Sets the blob value for a key.

SetValueBoolean

Integer

Sets the boolean value for a key.

SetValueByDataWindow

Integer

Sets the value of the key using the data from a DataWindow control, DataStore object, or DataWindowChild object.

SetValueDate

Integer

Sets the date value for a key.

SetValueDateTime

Integer

Sets the datetime value for a key.

SetValueNumber

Integer

Sets the number value for a key.

SetValueString

Integer

Sets the string value for a key.

SetValueTime

Integer

Sets the time value for a key.

TriggerEvent

Integer

Triggers a specific event in the object and executes the script for the event.

TypeOf

Object

Returns the type of the object.