Question
I am developing a process to map Json data obtained by the REST connector to a CSV file.
In this process, there are several hundred items in the Json data schema, and it takes a lot of time to edit and reference the mappings.
Is there any advice on improving efficiency of this mapping?
The main reason for the large number of schema items is that there are hundreds of repeated objects with a common schema in the "element" array object of List type data.
Answer
If all the array objects "element" of List type data have the same schema, it is possible to dynamically map to the array objects of the common schema by using the Iterate specified node logic and relative path specification in the Get Value by Xpath logic.
Please try the following steps to perform the mapping process.
- Place the Iterate specified node logic in mapper and connect one of the array objects "element" in the List type data to the [row] of the output data.
By connecting the element object that repeats the common element with the [row] of the output data using the Iterate specified node logic, the mapping process will be repeated for the number of element objects.
For objects outside of the List type data, the same value is input for all of them.
- Place the Get Value by Xpath logic and connect it to one of the "element" objects in the List type data.
Specify the Get Value by Xpath logic that specifies data in the List type data to any one of the "element" objects.
- Specify a path relative to the current directory in the Get Value by Xpath logic.
Prepend the path with a period ". " at the beginning of the path to specify a path relative to the current directory, you can dynamically specify a path for loop in the Iterate specified node logic.
Example: To specify the object "id" in an element, specify ". /id".
Comments
0 comments
Article is closed for comments.