Data Transformer
Data transformation is a key step in building integrations between services as the schemas of the data expected or returned by these services keeps changing.
To overcome this, you can use the Data transformer tool. Click on the next page in the sidebar to launch the tool in a new tab.
On the tool you can enter a JSON payload in its current and desired format and get a script to perform the transformation.
Here's an example:
info
Clicking 'Generate code' button will present you with a choice to send either schemas or full JSON data.
Sending full JSON gives OpenAI that extra context which you may have to provide yourself if you only send schemas.
Hence sending full JSON produces more reliable results but ensure there is no sensitive data in the Input/Output JSONs before you choose that option.
Upon hitting 'Generate code', You will get a Javascript function and a builder snippet. Both can be copied by the copy button on the respective code blocks.
Below the function, you will also get a diff-checker view of the JSON produced by the function and the JSON that you expected (Output JSON):
If both look the same as shown above, this means OpenAI was able to generate a good script. You can verify the function's correctness by testing it using more inputs and outputs.
If you notice some differences (highlighted by red, green and yellow colors) on the diff-checker component as shown above, it indicates the script was not good enough and you may need to provide some context in the context box.