JSON Parser validation rules (DataStage®)

By default, the JSON Parser uses minimal validation and ignores violations. To customize validation, specify the action to perform when a violation occurs.

The following tables describe the validation rules and the actions that the JSON Parser can complete based on the setting of the rule.

Table 1. Value validation rules
Rule Description Actions
Data type has illegal value The value must conform to the value rules for the data type of the corresponding item.
Ignore
Type checking is not performed. The data types of the items as they are defined by the schema are replaced by the String type. For example, if the schema includes an item named income that has the decimal data type, the data type of the item in the step output becomes String.
Log per Occurrence; Log once per Document
Log per occurrence logs error for each occurrence and log once per document logs error for the first occurrence of all errors of the entire document.
Reject
Type checking is performed. Only invalid values fail the invalid document parsing. The ParsingStatus item is added as a new group to the step output for the JSON Parser step and is set to False. The ParsingStatus item contains the corresponding error message.
Fatal
Type checking is performed. An invalid value causes the job to fail.
Using global default value
If the value is not present for any key, then it takes the value that is specified in the administration page.
Trim values Trim the white space before and after a value before performing type checking and type conversion.
False
Trimming is not performed.
True
Trimming is performed on both sides of the value.
Table 2. Structure validation rules
Rule Description Actions
Document is malformed The document is malformed.
Ignore
No error message is logged.
Log once per Document
An error message is logged.
Reject
The ParsingStatus item, which is added as a new group to the step Output for the JSON Parser step, is set to False and includes the corresponding error message.
Fatal
A malformed document causes the job to fail.
Items are not declared in the schema Items in the instance document must be declared in the schema. Violations might occur when a job uses a version of a schema that is outdated.
Ignore
No error message is logged. Items are parsed based on best guess.
Log per Occurrence; Log once per Document
Error messages are logged. Items are parsed based on best guess.
Reject
The ParsingStatus item, which is added as a new group to the step Output for the JSON Parser step, is set to False and includes the corresponding error message.
Fatal
An item that is not declared in the schema causes the job to fail.