Created on 25 January 2022
icon_unfollowing
Login to follow
jsonata-transformation

JSONata Transformation

Stable version 2.6.1 (Compatible with OutSystems 11)
Uploaded on 25 Feb by 
jsonata-transformation

JSONata Transformation

Documentation
1.2.0

Getting started article Transform JSON Data with JSONata in OutSystems (without.systems) 


JSONata is a JSON document transformation and manipulation library. It is especially useful when you have to deal with dynamic JSON data returned from an REST API. JSONata allows you to transform that dynamic result to a structured result to have it deserialised to an OutSystems structure.

Example

Lets take a look at the following JSON document

* (How do i add code here ?)

Look at data.keys. Keys holds a dictionary with a number as the key. In addition the value of that key is either an object or (for 3) just a number.

The goal is now to transform this JSON to something like this


Here we transformed the dictionary to an array. We also added the key of the dictionary as version to the object element and we solved the problem of having sometimes an object and sometimes just a number. In order to get there we need to write a JSONata transform. For the example above we use this one

This JSONata transformation transforms the data.keys element leaving all other properties as they are. Please see the JSONata documentation for additional transformation functions and manipulation options.

How to use

Add a depencency to Json_Transform of the JSONata_IS module

The Json_Transform server action takes the original JSON document (as string) and the transform document (as string) as input.

If transformation succeeds it returns IsSuccess = true. Otherwise it returns false and the Error Output contains the error message.

The Result output parameter contains the transformed Json. You can now deserialize that to an OutSystems structure.

Happy Low Coding!


Support options
This asset is not supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from  who created this asset.
Dependencies
JSONata Transformation has no dependencies.