Links

JSON Generator

Know the component and how to use it.
JSON Generator (Mock) creates a JSON object. This component accepts any input.
Take a look at the configuration parameters of the component:
  • JSON: the JSON object that will be the output of the component. Double Braces expressions are supported.
  • Fail on Error: if you activate this option, the pipeline execution will be interrupted if an error occurs during the execution of this component. If you deactivate it, when an error happens, the component will output an error message in JSON format, but the pipeline execution will continue. Incorrect use of this option can lead to false success messages in the subsequent steps of your pipeline.

Usage example

In this example, we used the JSON Generator (Mock) component to modify someone’s data. Here, we want to join the firstName and lastName properties into a single property called fullName. We also want to delete the phoneNumber property and add a property called country, which has the value “Brazil”.

Input

{
“firstName” : “Carlos”,
“lastName” : “Silva”,
“phoneNumber” : “+55(11)99999-8888
}

Parameter settings

We use the JSON Generator (Mock) component with the following JSON parameter configuration:
{
"fullName" : {{ CONCAT(message.firstName," ", message.lastName) }},
"country" : "Brazil"
}
Here, we used the CONCAT Double Braces function to join the first and last names, with a blank space between them.

Output

{
"fullName": "Carlos Silva",
"country": "Brazil"
}