Enhanced JSONPackage object

The GetValue function of the JSONPackage object always returns the result in string, and the SetValue function only sets string-type values. Now there are more functions in the JSONPackage object for getting or setting values of various types.

  • GetValueBlob -- Gets the blob value of the key.

  • GetValueBoolean -- Gets the boolean value of the key.

  • GetValueDate -- Gets the date value of the key.

  • GetValueDateTime -- Gets the datetime value of the key.

  • GetValueNumber -- Gets the number value of the key.

  • GetValueString -- Gets the string value of the key.

  • GetValueTime -- Gets the time value of the key.

  • SetValueBlob -- Sets the blob value for a key.

  • SetValueBoolean -- Sets the boolean value for a key.

  • SetValueDate -- Sets the date value for a key.

  • SetValueDateTime -- Sets the datetime value for a key.

  • SetValueNumber -- Sets the number value for a key.

  • SetValueString -- Sets the string value for a key.

  • SetValueTime -- Sets the time value for a key.

You can now directly get values from the JSONPackage object into DataWindows, or set the key values in the JSONPackage object from DataWindows.

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

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

The JSONPackage object also provides the GetItemType function which works the same as the GetItemType function in the JSONParser object.

  • GetItemType -- Gets the type of item.

The SaveToFile and GetJsonBlob functions for JSONPackage (and JSONGenerator) are enhanced to specify the character encoding of the resulting blob.

  • SaveToFile

    SaveToFile ( FileName {, Encoding e} )
  • GetJsonBlob

    GetJsonBlob ( {Encoding e} )

For the newly-added or enhanced functions, see the section called “JSONPackage object” in Objects and Controls for more details.

The following new property is added to the JSONPackage object (also added to JSONParser):

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

    You can use this property to avoid throwing an exception in cases when a getting item function returns null.

    See the section called “ReturnsNullWhenError” in Objects and Controls for more details.