JOLT Spec
JOLT (Json Language for Transform) is a transformation library that allows converting one JSON structure to another. It provides a set of transformation types each with its own specification file that defines the structure of outgoing JSON data.
The JOLT transformation is capable of mapping the back-end fields and the Microservice fields directly by using its different transformation types and their corresponding specification files. It reduces the overhead of using large number of getter setter methods.
JOLT Specification File
The Jolt Specification File defines the line-by-line instructions for transforming one JSON structure to another. The specification file can also include mapping of extension data. For more information, refer to Extensibility through JOLT. The input (JSON) file is transformed according to the specification file to obtain the required output (JSON) file.
To obtain the required output (JSON) file, the input (JSON) file is transformed according to the specification file.
There are two sample JSON files attached at the end of the doc to depict the functionality of JOLT. You can try them here.
Input JSON
{
"ARRAY_PartyType": [{
"RECORD_PartyType": {
"PartyType": "CUSTOMER",
"PartyId": "190179",
"RelationCode": "402",
"RelatedAs": "PARENT ENTITY",
"RelPartyType": "CUSTOMER",
"RelPartyId": "190184",
"OwningPerc": "10",
"SUB_ARRAY_Comments": []
}
}]
}
Sample JOLT Specification File
[{
"operation": "shift",
"spec": {
"ARRAY_PartyType": {
"*": {
"RECORD_PartyType": {
"OwningPerc": "ownershipPercentage"
}
}
}
}
}]
Here the OwningPerc field under RECORD_PartyType from the back end is mapped to the ownershipPercentage field in the Microservice. The operation field defines the type of transformation (shift) and inside the spec, the line-by-line specification for the particular transformation is written.
Output JSON
{
"ownershipPercentage": "10"
}
Based on the specification file the value in the OwningPerc field is mapped to the output JSON with the field name, ownership percentage.
Party Transformation files
- For the transformation of CUSTOMER fields in Transact, CUSTOMEREvent.Party.json holds the specifications for mapping Backoffice fields to MS-specific fields.
Sample: CUSTOMEREvent_Party.json
- CUSTOMER.GROUP fields in Transact are mapped to the appropriate Microservice fields by using the CUSTOMER_GROUPEvent_GroupMembers.json specification file. Similarly, for other entities such as PartyGroups. RelatedMembers, GroupIdentifier, Addresses, AlternateIdentity, Classification, Employment, Role, and Party Relationship, a separate JOLT specification file is present that does all the required transformations from the back end to Microservice.
- For the transformation of ADDRESSTYPE fields in Transact, EB_LOOKUPEvent_AddressType.json holds the specifications for mapping Backoffice fields to MS-specific fields.
Sample: EB_LOOKUPEvent_AddressType.json
- For the transformation of REFERENCE fields in Transact, EB_LOOKUPEvent_Reference.json holds the specifications for mapping Backoffice fields to MS-specific fields.
- For the transformation of ADDRESSES fields in Transact, DE_ADDRESSEvent_Addresses.json holds the specifications for mapping Backoffice fields to MS-specific fields.
- Sample : DE_ADDRESSEvent_Addresses.jsonDE_ADDRESSEvent_Addresses.json
Sample: EB_LOOKUPEvent_Reference.json
In this topic