Jolt Json Mapper Dialog
The Jolt Json Mapper creates a Jolt Specification file as mappings added in the Jolt Json Mapper dialog.
The Json Transform Mapper dialog is displayed when the correct and valid input and output json files are added in the Input Json Schema File and Output Json Schema File fields and the Map Input Output Json button in the General tab.
Input and Output Tree Panels
-
The input and output tree can be expanded by clicking on the arrows beside the elements in the tree.
-
Elements that have the same json type can only be mapped from the input to the output tree. For example, a json array cannot be mapped to a json object or a json string element and vice versa.
-
The parent array should be mapped before mapping its child elements. If not mapped then on selecting the Generate Jolt Spec button an error occurs.
-
The Functions tab applies the String, Number or Array to the output tree.
Sort Output
-
To sort the json output activity select the Sort Output check box. If this check box is not selected, the output will not be in a sorted order.
Note: For sorting, only ascending order is supported and sorting is done alphabetically on the element names in the output json.
Default Value
-
To add a default value for an output element, click on the element and then add the default value in the Default Value text box.
-
If a mapping is done on an element for which a default value is provided, the mapping takes precedence. The default value is cleared when the input tree element is dragged and dropped on the output tree element.
Set Explicitly Null/Empty
-
The Set null or Set empty radio buttons sets the values of any elements in the output json with a default value as Null or Empty.
Note: The Set empty button is only to String data type. For all other data types apply the Set null button. The Set null can also be used for String data type.
Function
-
The Function text box displays the functions signature as added in the Functions tab.
Note: If we are using special characters like "+, ()", add a escape character "\" before each of the special characters.
For example, concat("rootTibco.inroot.BIG",\)\+,"rootTibco.inroot.small",+) -
The String, Number, and Array Functions are supported.
-
To apply a function to an output field, drag and drop a function from the left function tree to the required element in the output tree. After dropping the function, the output element displays the function signature in the Function text box in the Input/Output trees.
Jolt Spec Output
-
After the elements are mapped correctly, click the Generate Jolt Spec button. This generates the jolt specifications based on the mappings, functions applied the Sort Output check box and the if any default values provided for the output element.
-
The generated jolt specification string is displayed in the Jolt Spec text box. The output json from applying the jolt specification generated to the input json is displayed in the Applied Spec Output text box.
Delete Selected Mapping
-
The Delete Select Mapping button deletes a mapping from the input to output tree. It also deletes a mapping from the underlying data model. Select the mapping line to delete a particular mapping. Regenerate the jolt specification after deleting a mapping.
Clear Mappings
-
The Clear Mappings buttons clears all the mappings from the input to the output tree.
Clear All Data
-
The Clear All Data button resets the mapper and all the data mappings stored in it. This button clears all the mappings from the input to the output tree, clears the Sort Button (if selected), and removes any default values set on the output tree.
Note: It is recommended to use this button if new input and output json or json schema files are provided in the General tab.