Transforming JSON to application data by using the TRANSFORM JSONTODATA API command

You can use the TRANSFORM JSONTODATA API command in your application to transform JSON to application data.

Before you begin

You must have an enabled JSONTRANSFRM resource that defines the JSON binding and JSON schema.

About this task

The application must use a channel-based interface.

Procedure

  1. Create a channel and put into the channel an input container that contains the JSON to be converted.
    Note: This channel will also have an output container that contains the converted data when the TRANSFORM JSONTODATA command completes. Do not create the output container before issuing TRANSFORM JSONTODATA because the container is created and populated as part of the command itself.
  2. Use the TRANSFORM JSONTODATA command to transform JSON to application data.
    For example:
    
    EXEC CICS TRANSFORM JSONTODATA CHANNEL(
    ChannelName
    ) INCONTAINER(
    InpContainerName
    ) OUTCONTAINER(
    OutContainerName
    ) TRANSFORMER(
    BundleName
    )
    

Results

When the application runs the TRANSFORM JSONTODATA command, CICS® checks the JSONTRANSFRM bundle resource to find the mappings in the JSON binding and transforms the JSON to the application binary data by using the containers on the channel. On return, the converted data is placed in the container that is specified in the OUTCONTAINER option of the TRANSFORM JSONTODATA command. If the option is omitted, DFHJSON-DATA is used by default.