Enhanced JSONGenerator 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),

JSONGenerator object has added or improved the following functions:

  • New ImportFile and ImportString functions -- Imports a JSON item from a JSON string or file.

  • New GetItemByPath and GetPathByItem functions -- Gets item handle by path or gets path by item handle.

    The following functions have been enhanced to add items by path: AddItemArray, AddItemBlob, AddItemBoolean, AddItemDate, AddItemDateTime, AddItemNull, AddItemNumber, AddItemObject, AddItemString, and AddItemTime.

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

    • AddItemNumber, ImportFile and ImportString support the parameter which contains JsonNaN/JsonPositiveInfinity/JsonNegativeInfinity value

    • GetJSONString supports the returned value which contains JsonNaN/JsonPositiveInfinity/JsonNegativeInfinity value

JSONGenerator object also enhances the SaveToFile and GetJsonBlob functions to specify the character encoding of the resulting blob.

  • SaveToFile

    SaveToFile ( FileName {, Encoding e} )
  • GetJsonBlob

    GetJsonBlob ( {Encoding e} )

For more information, see the section called “SaveToFile” in PowerScript Reference and the section called “GetJsonBlob” in PowerScript Reference.