Kumologica: Data Mapping Using DataMapper Node
DataMapper node is based on JSONata, and supports the entire range of query and transformation functionality supported by JSONata.
Join the DZone community and get the full member experience.Join For Free
REST-based APIs have become the main building blocks in the modern digital ecosystem. API-based integration is becoming the default model for integration within the organization, and also to expose an organization's business functionality to their partner network or even to the general public. For these APIs, data is the main constituent.
An ideal situation within an enterprise is for all the constituent applications to work with homogenized enterprise data structures to promote and ease interoperability between them. But given the history of the evolution of applications within an enterprise, this is a tall ask. Although enterprises are promoting internal efforts towards this, having this as a pre-requisite for applications to interconnect and consume exposed business logic is not practical.
A more robust solution is to transform the data from one format into a format that the API can work with. This is data transformation. Data transformation is the process of converting data from one format to another. This will help us to break the data silos that exist between applications and make them interoperable.
Kumologica 2.0 provides the DataMapper node that can be used for format transformation of JSON data. DataMapper node is based on JSONata, and supports the entire range of query and transformation functionality supported by JSONata.
In this video, I will show you how we can use the DataMapper node to transform JSON data from one format to another and to locally test the flow to check that the transformation is working as expected.
The API used in the video will accept JSON data in the following format:
JSONata expression used in the datamapper node is as below:
And the final transformed JSON data will be in the following format:
Opinions expressed by DZone contributors are their own.