Parameter values for the JSON parser

You can set JSON parser properties at the integration server level.

You can set properties for the JSON parser by modifying the integration server's server.conf.yaml file or by using the mqsichangeproperties command.

Setting JSON parser properties in the server.conf.yaml file

You can set the JSON parser properties by specifying them in the JSON section of the integration server's server.conf.yaml file:


JSON:
    #escapeMode: strict  # Specifies whether the JSON parser escapes forward slash characters when it is serializing a message tree. 
                         # Choose one of preserveForwardSlashes|strict. Default is strict if unset.
                         # To specify that the JSON parser must leave forward slashes unchanged in the output, set the value to 
                         # preserveForwardSlashes.
    #allowScientificNotation: true  # Specifies whether the JSON parser serializes numerical values using scientific notation 
                                    # for example 1.10E+1). 
                                    # Default is true if unset.
                                    # To specify that the JSON parser should use scientific notation, set the value to true.
                                    # To specify that the JSON parser should use decimal notation, set the value to false.
    #disableSchemaLookupExceptionWhen: '' # Comma-separated list of events that will not throw exceptions when validation is 
                                          # requested of the JSON parser and a JSON schema cannot be loaded.
                                          # When an event in the list occurs, no exception will be thrown and instead the JSON parser 
                                          # will continue to parse but without validation.
                                          # Valid events are 'notSpecified', 'notFound'. If unset will default to '' which means that 
                                          # no exceptions are disabled.
                                          #   'notSpecified' disables the BIP5736 exception that is thrown if a JSON schema name is 
                                          #    not supplied.
                                          #   'notFound' disables the range of exceptions (BIP1318, BIP1312, BIP5737, BIP5738, BIP5739) 
                                          #    that are thrown if a JSON schema name is supplied, but cannot be resolved.
                                          # This option is available to allow behavior from previous releases to be maintained. 
    #numberPrecisionType: default  # Specifies whether the JSON parser parses precision numbers as decimal. Choose either default or 
                                   # decimal. By default, precision numbers are parsed as double-precision floating-point numbers.

If you modify properties in the server.conf.yaml file, you must restart the integration server for the changes to take effect.

Setting JSON parser properties by using the mqsichangeproperties command

To change the JSON parser properties by using the mqsichangeproperties command, specify the integration node name, the integration server name, and the properties and values that you want to set by using the -n and -v parameters. You must set the component (by using the -o parameter) to ComIbmJSONParserFactory. For example:
mqsichangeproperties integrationNodeName -e integrationServerName -o ComIbmJSONParserFactory -n property_name -v property_value

You can use the mqsichangeproperties command to change the following properties and values for the JSON parser:

-n escapeMode -v value
Specifies whether the JSON parser escapes forward slash characters when it is serializing a message tree. This value must be set to either preserveForwardSlashes or strict.
By default, the JSON parser escapes forward slash characters. Values such as http://myURI appear as http:\/\/myURI in the output bit stream.
To specify that the JSON parser must leave forward slashes unchanged in the output, set the value to preserveForwardSlashes.
You can re-enable the default behavior by setting the value to strict.
For example, the following command specifies that forward slash characters are left unchanged in the output:
mqsichangeproperties integrationNodeName -e integrationServerName -o ComIbmJSONParserFactory -n escapeMode -v preserveForwardSlashes
-n allowScientificNotation -v value
Specifies whether the JSON parser serializes numerical values using scientific notation (for example 1.10E+1). This value can be set to either true or false. If this property is unset, the default is true.

To specify that the JSON parser should use scientific notation, set the value to true. To specify that the JSON parser should use decimal notation, set the value to false.

For example, the following command specifies that the JSON parser serializes numerical values using decimal notation:
mqsichangeproperties integrationNodeName -e integrationServerName -o ComIbmJSONParserFactory -n allowScientificNotation -v false
-n disableSchemaLookupExceptionWhen -v value
Specifies events that do not throw exceptions when JSON parser validation is requested but a JSON schema cannot be loaded. When one of these events occurs, no exception is thrown and the JSON parser continues to parse without validation. The events are specified by one or more of the following values, separated by commas:
  • notSpecified disables the BIP5736 exception that is thrown if a JSON schema name is not supplied
  • notFound disables the range of exceptions (BIP1318, BIP1312, BIP5737, BIP5738, BIP5739) that are thrown if a JSON schema name is supplied but cannot be resolved

If this property is unset, the default is '', which means that no exceptions are disabled.

For example, the following command specifies that no exceptions will be thrown when a JSON schema name is not supplied or when it is supplied but cannot be resolved:
mqsichangeproperties integrationNodeName -e integrationServerName -o ComIbmJSONParserFactory -n disableSchemaLookupExceptionWhen -v notSpecified,notFound
-n numberPrecisionType -v decimal
Specifies whether the JSON parser parses precision numbers as decimal. Choose either decimal or default. For example:
mqsichangeproperties ACE_NODE -e is01 -o ComIbmJSONParserFactory -n numberPrecisionType -v decimal

If this property is set to default or is left unset, precision numbers are parsed as double-precision floating-point numbers.

You can show the current JSON parser settings by using the mqsireportproperties command, as shown in the following example:
mqsireportproperties  ACE_NODE -e is01 -o ComIbmJSONParserFactory -a
The output of this command has the following format:

ComIbmJSONParserFactory
  name='JSON'
  identifier='ComIbmJSONParserFactory'
  type='resourceManager'
  allowScientificNotation='true'
  disableSchemaLookupExceptionWhen=''
  escapeMode='strict'
  numberPrecisionType='decimal'
  objectStructure='compatibility'
  active
    serverRestartRequired='false'