Enhanced JSONParser object

In order to support

  1. getting and setting an item by path, and

  2. handling special values such as JsonNaN (invalid number), JsonPositiveInfinity (positive infinity), and JsonNegativeInfinity (negative infinity),

JSONParser object has added or improved the following functions:

  • New GetNumberType function -- Determines the value type of a number item: JsonNumber, JsonNaN, JsonPositiveInfinity, or JsonNegativeInfinity.

  • The following functions have been enhanced to support JsonNaN, JsonPositiveInfinity, and JsonNegativeInfinity:

    • LoadString supports to load a string which contains JsonNaN/JsonPositiveInfinity/JsonNegativeInfinity value

    • LoadFile supports to load a file which contains JsonNaN/JsonPositiveInfinity/JsonNegativeInfinity value

    • GetItemObjectJSONString and GetItemArrayJSONString support the returned object or array which contains JsonNaN/JsonPositiveInfinity/JsonNegativeInfinity value

    • GetItemNumber supports to get value which is JsonNaN/JsonPositiveInfinity/JsonNegativeInfinity

  • New GetItemByPath function -- Gets the item handle according to the path.

    The following functions have been enhanced to get items by path: GetChildCount, GetChildKey, GetChildItem, GetItemArray, GetItemBlob, GetItemBoolean, GetItemDate, GetItemDateTime, GetItemNumber, GetItemObject, GetItemString, GetItemTime, GetItemType, and ContainsKey.

  • New ContainsPath function -- Checks if a path exists.

  • New GetItemObjectJSONString and GetItemArrayJSONString functions -- Gets the string value (in JSON format) of the object item or array item.

JSONParser object also adds or enhances the following functions:

  • New ContainsKey in PowerScript Reference function -- Checks if the key name exists.

    You can use this function to check whether certain key exists in a JSONParser object before executing other functions, such as GetItem.

  • Enhanced GetItemType in PowerScript Reference function -- Gets the type of item.

    It is now possible to specify the key of a child item, and directly get the type of the child item.

  • New ReturnsNullWhenError in Objects and Controls property -- Specifies whether the getting item 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.