Base64 encodes and decodes from/to fields, payload and files in base64 string format.

Take a look at the configuration parameters of the component:

  • Operation:

- Encode Fields: encodes the JSON fields.

- Decode Fields: decodes the JSON fields.

- Encode Payload: encodes the received payload.

- Decode Payload: decodes the received payload.

- Encode File: encodes the received file.

- Decode File: decodes the received file.

  • JSON Field: JSON path to be encoded or decoded. The fields must be separated by comma (eg.: field1,field2).
  • Preserve Original: if enabled, the option preserved the original fields and changes prefixes by adding the underline character (_).
  • Payload: field to directly inform the payload that will have its content encoded/decoded (eg: body, data, {{ message.payload }}).
  • Result As File: if enabled, the option saves the encode or decode result in a file (valid for the “encode_payload” and “decode_payload” operations only).
  • File Name: name of the file to be compressed.
  • Output File Name: name of the output file after a file is encoded/decoded (valid for the “encode_file” and “decode_file” operations only).
  • Fail On Error: if the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution continues, but the result will show a false value for the success property.

Some of the parameters above accept Double Braces. To better understand how this language works, read our article by clicking here.

Messages flow

Input

For the “encode_fields” and “decode_fields” operations, the component expects to receive a JSON containing the fields configured in the JSON Field property.

Example:

Configuration

JSON Field = field1,field2

The expected JSON must at least have:

{
"field1": "SOMETHING",
"field2": "SOMETHING"
}

For the “encode_payload” and “decode_payload” operations, you must configure the “Payload” field to encode/decode.

Example:

Configuration

Payload = {{ message.field1 }}

The expected JSON must at least have:

{
"field1": "SOMETHING"
}

For the “encode_file” and “decode_file” operations, you must configure the file that will be encoded/decoded and the resulting file of this operation.

Example:

File Name = input.csv

Output File Name = outputfile.csv

Output

For the “encode_fields” and “decode_fields” operations:

{
"field1": "SOMETHING ENCODED/DECODED",
"field2": "SOMETHING ENCODED/DECODED",
"_field1": "ORIGINAL VALUE",
"_field2": "ORIGINAL VALUE",
}

For the “encode_fields” and “decode_fields” operations, if the input message is preserved:

{
"field1": "SOMETHING ENCODED/DECODED",
"field2": "SOMETHING ENCODED/DECODED",
"_field1": "ORIGINAL VALUE",
"_field2": "ORIGINAL VALUE",
}

For the “encode_payload” and “decode_payload” operations, if the output is a file:

{
"success": "true",
"fileName": "file.csv"
}

For the “encode_payload” and “decode_payload” operations, if the output is a string:

{
"success": "true",
"result": "SOMETHING ENCODED/DECODED"
}

For the “encode_file” and “decode_file” operations:

{
"success": "true",
"fileName": "file.csv",
"outputFileName": "file.csv"
}
Did this answer your question?