JSONParser object

The JSONParser object provides the ability to load the JSON-formatted data from a string or from a TXT file into a JSON object, and then parse the JSON object to get the child item count, get the handle, key name or value of any specified item, etc.

Note

This object cannot be referenced in .NET Web Service or .NET Assembly components, otherwise the component will fail to be deployed.

Properties

JSONParser property

Datatype

Description

ClassDefinition

PowerObject

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

ReturnsNullWhenError

Boolean

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


Events

JSONParser event

Occurs

Constructor

Immediately before the Open event occurs in the window

Destructor

Immediately after the Close event occurs in the window


Functions

JSONParser function

Datatype returned

Description

ClassName

String

Returns the name assigned to the object.

ContainsKey

Boolean

Checks if the key name exists.

GetChildCount

Long

Gets the child item count.

GetChildItem

Long

Gets the child item handle.

GetChildKey

String

Gets the key name of child item.

GetContextService

Integer

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

GetItemArray

Long

Gets the handle value of the child array item.

GetItemBlob

Blob

Gets the blob value of the item.

GetItemBoolean

Boolean

Gets the boolean value of the item.

GetItemDate

Date

Gets the date value of the item.

GetItemDateTime

DateTime

Gets the datetime value of the item.

GetItemNumber

Double

Gets the double value of the item.

GetItemObject

Long

Gets the handle value of the child object item.

GetItemString

String

Gets the string value of the item.

GetItemTime

Time

Gets the time value of the item.

GetItemType

JSONItemType

(enumerated)

Gets the type of item. Values are:

JsonStringItem! -- Type of the JSON node whose key value pair is a string, such as "name":"evan".

JsonNumberItem! -- Type of the JSON node whose key value pair is a number, such as "id":1001.

JsonBooleanItem! -- Type of the JSON node whose key value pair is a boolean, such as "active":true.

JsonNullItem! -- Type of the JSON node whose key value pair is null, such as "remark": null.

JsonObjectItem! -- Type of the JSON node whose key value pair is an object, such as "date_object":{"datetime":7234930293, "date": "2017-09-21", "time": "12:00:00"}.

JsonArrayItem! -- Type of the JSON node whose key value pair is an array, such as "department_array":[999999, {"name":"Website"}, {"name":"PowerBuilder"}, {"name":"IT"}].

GetParent

PowerObject

Returns a reference to the name of the parent object.

GetRootItem

Long

Gets the root item handle.

LoadFile

String

Loads a JSON file. The JSON file cannot contain special characters such as ~r~n or ~t, otherwise, LoadFile will throw the error "Invalid encoding in string".

LoadString

String

Loads a JSON string. The JSON string cannot contain special characters such as ~r~n or ~t, otherwise, LoadString will throw the error "Invalid encoding in string".

PostEvent

Boolean

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

TriggerEvent

Integer

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

TypeOf

Object

Returns the type of the object.