Filter Output Data Using the JSON Formatter Snap's Content Setting

This example demonstrates how, effective 4.20 Patch transform8670 and onwards, you can use the JSON Formatter Snap to filter the input JSON data.

  1. Generate a JSON document using the JSON Generator Snap.

    Output showing only $payload

  2. In the Mapper Snap, map the input fields: interface_id, failed_pipeline, target_url, and payload to the required output fields.
    File Writer Snap Settings

  3. In the JSON Formatter Snap, in the Content field under Settings, select $payload as the object to be included in the output.
    JSON Formatter

  4. Select the JSON lines checkbox to ensure each record appears as a separate line in the output file.
  5. Provide the name of the file to write to in the File Writer Snap and save it.
  6. Validate and execute the pipeline. With Patch transform8670 onwards, the JSON Formatter Snap correctly acknowledges the Content field, irrespective of the JSON lines checkbox selection. So, in this example, the output would contain only the specified object’s data ($payload):

    Current Behaviour - Output of JSON Snap

    Prior to Patch transform8670, the JSON Formatter Snap would ignore the value in the Content field and write the entire input data to the output file if the JSON lines check box was selected, as shown in the image below:

    New Behaviour - Output of JSON Snap

To reuse the pipeline:
  1. Download and import the pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide pipeline parameters as applicable.