json.Serializer.getOption

Returns the current value of a JSON serializer option.

Syntax

getOption(
   name STRING) RETURNS STRING
  1. name is the name of an option of the JSON serializer of type STRING.

Usage

Use this method to return the current value of a JSON serializer option. The method returns the value in the spelling the option topic lists, such as "1" or "RFC3339/UTC". json.Serializer.setOption accepts that value back, so you can save an option and restore it later. For the available options, go to json.Serializer options.

An empty or NULL option name raises error -15823. An unknown option name raises error -15824.

In case of error, the method throws an exception and sets the status variable. Depending on the error, a human-readable description of the problem is available in the sqlca.sqlerrm register. See Error handling in GWS calls (status).

Example: return option value

Return the value of the allowNullAsDefault or serializeNullAsDefault options. In this example, the allowNullAsDefault option is returned.

IMPORT json
MAIN
    DEFINE allowNull STRING
    # Read the current value: "0" (default) or "1"
    LET allowNull = json.Serializer.getOption("allowNullAsDefault")
    DISPLAY "allowNullAsDefault: ", allowNull
END MAIN