JSON Generator (Mock)
Discover more about the JSON Generator (Mock) connector and how to use it on the Digibee Integration Platform.
JSON Generator (Mock) creates a JSON object. This connector accepts any input.
Parameters
Take a look at the configuration options for the connector. Parameters supported by Double Braces expressions are marked with (DB)
.
JSON (DB)
The JSON object that will be the output of the connector.
N/A
JSON Object
Fail on Error
If the option is activated, the pipeline's execution with an error will be interrupted. Otherwise, the pipeline execution proceeds, but the result will show a false value for the "success"
property.
False
Boolean
Using Global variables
Global variables can be retrieved in the JSON Generator (Mock) connector using the following Double Braces expression:
You can retrieve Globals in two ways:
As a string
As a number
Retrieving Global variables as a string
If the Global variable’s value is a string, regardless of its category, you must enclose the Double Braces expression in double quotes.
For example, suppose you create a Global named global-email under the Email category and set an email address as its value. The Platform will interpret this value as a string. Therefore, to retrieve this Global variable in the JSON Generator (Mock) connector, structure the expression as follows:
If you don’t enclose the expression in double quotes, you will receive the following error:
This rule applies to any Global variable with a string value.
Retrieving Global variables as a number
If the Global variable’s value is a number, don’t enclose the Double Braces expression in double quotes. Otherwise, the number will be treated as a string.
For example, suppose you create a Global named global-id under the ID category and set its value to 1234.
To retrieve this Global variable as a number in the JSON Generator (Mock) connector, structure the expression as follows:
The output will be:
However, if you need to retrieve it as a string, simply enclose the expression in double quotes:
This will return:
Usage example
In this example, we used the JSON Generator (Mock) connector 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
Parameter settings
We use the JSON Generator (Mock) connector with the following JSON parameter configuration:
Here, we used the CONCAT Double Braces function to join the first and last names, with a blank space between them.
Output
Last updated
Was this helpful?