New function JSONGetType( json ; keyOrIndexOrPath )

Idea created by arnoldkegebein on Oct 20, 2017
    Active
    Score18

    Idea

    Adding a new function to the collection of JSON function:

         JSONGetType( json ; keyOrIndexOrPath ).

     

    The function will return the type of the targeted json path element:

    1. JSONString
    2. JSONNumber
    3. JSONObject
    4. JSONArray
    5. JSONBoolean
    6. JSONNull

     

    Benefits

    The new JSON functions support the development of general, exchangeable codes (aka modules). Using json to pass data between scripts, modules and systems will help to develop robust interfaces. With the new function JSONGetType the program can react variable according the json data type.

    For example:

    • With the function it is possible to distinguish between JSONNull and an empty JSONString.
    • If the type is JSONObject or JSONArray, the script can continue to process the content in a loop accordingly.