JSON Composer step

Use a JSON schema or a view created from the JSON schema to compose JSON data.

JSON Target

Write to file
Enter the output directory and the file name prefix for the files to compose, or click Insert Parameter and then select the name of the parameter for the output directory and file name prefix. The parameters that are available are those that you previously defined in the job and the built-in macros that are in IBM® InfoSphere® DataStage®.
Pass as string
Pass the composed JSON string to a downstream step or stage for further processing.
Pass as large object
Pass the composed JSON string as a large object. The last stage in the job must be a LOB-aware stage, such as the Db2 connector, Oracle connector, ODBC connector, Teradata connector, or Websphere MQ connector. These stages use the LOB locator string to obtain the JSON data and then write it to the target database or message queue. The job can contain stages that are not LOB-aware, but the stages must not modify the LOB locator string. If the last stage in the job is not LOB-aware, the LOB locator is written as data and is not interpreted as a locator.

Document Root

Select the top-level element or a view of a JSON schema that describes the JSON data that you want to compose. The JSON schema is a schema generated while importing a JSON data instance into the schema library.

Validation

By default, the JSON Composer uses strict validation, and the job fails if a violation occurs. To customize validation, specify the action to perform when a violation occurs.

Mappings

Create a mapping to the document_collection item. How you map this item determines whether one document or multiple documents are created. To produce only one document, map the root of the input (top) to the document_collection item. If you want each item in the list to be in a separate document, then map a list to the document_collection item.. If you produce multiple documents, one file is created for each item in the list. For more information about mapping, see Working with the mapping table.

An JSON array is modelled as multiple occurrences of mixed types. The choiceDescriminator indicates which choice branch you should select for the particular array element. Below is an example of JSON array.

[
	{"type": "home", "number": "212 555-1234"},
	[116, 943, 234],
	true
]

In the above example, the choiceDescriminator has the value of objectValue for the first array element which is an object. The choiceDescriminator has the value of arrayValue because the second array element is a nested array. The choiceDescriminator has the value of booleanValue. The choiceDescriminator value contains stringValue, numberValue, booleanValue, nullValue, objectValue, and arrayValue. When composing the JSON data you need to choose which value should be used from the available values.

Format

Encoding type
Select the encoding to use for the document. The default encoding is UTF-8.
Format style
Apply the following format options to the JSON output:
Indentation length
Select the number of characters to use for each indentation level in the JSON output.
New line style
Select the type of new line. Choices are UNIX (LF), DOS(CRLF) or MAC(CR).