Instructions
How to use the "Outsystems2JSON" action
The next steps will guide you on how to use this component. In the end, you should have an action that serializes an OutSystems value to JSON.
1. Create the dependencies that allow the usage of the component
The action "Outsystems2JSON" is used to convert OutSystems variables to JSON and send it to external environments.
To use it, add a dependency in your application according to the picture below.
2. Create a flow to transform variables from Outsystems to JSON
Create a server action and call "Outsystems2JSON" action.
For simple and complex types:
Fill the input parameter "value" with the ToObject() function with the variable to transform inside.
See below an example
For Date, Datetime and Time:
Fill the input parameter "value" with the ToObject() function with the variable to transform inside. and choose a value between 0 and 3 for the different date format types that are explained in the right comment of the image above.
As a result of this transformation now you have the JSON ready to send it to external environments.
How to use the "JSON2Outsystems" action
The next steps will guide you on how to use this component. In the end, you should have an action that adds Records to a Record List containing the de-serialized JSON.
The action JSON 2 RecordList is used to convert JSON into Outsystems variables in order to be readable in the Outsystems platform.
2. Create a flow to transform variables from JSON to Outsystems
Create a server action and call "JSON2RecordList" action, as can be seen in the picture below as a sample.
Fill the input parameter "JSON" with the JSON to transform and the parameter "RecordList" with ToObject() function with the variable to transform inside.
Example of a structure used
As a result of this transformation now you have the variables in a format to be read by the Outsystems platform.
How to use the "JSONSelect" action
The next steps will guide you on how to use this component. In the end, you should have an action that allows simple path selection of an element in the JSON.
The action JSONSelect is used to retrieve a path from a JSON.
2. Create a flow to retrieve the path of a JSON
Create a server action and call "JSONSelect" action, as can be seen in the picture below as a sample.
Fill the input parameter "JSONIn" with the JSON to process and the parameter "Path" with the path to retrieve.
You optionally enable set the "AlwaysReturnAsJSON" parameter to true to force the result to always be a valid JSON.If set to false (default value), when the path string parse will result in a single element, instead of returning the result inclosed in double quotes (valid JSON), the result will not include the enclosing quotes.
Path expresions:
See: JSONPath expressions - https://goessner.net/
As the result of this transformation now you only have the JSON path selected.
How to use the "JSON_Listify" action
The next steps will guide you on how to use this component. In the end, you should have an action that allows the replacement of the original JSON into a JSON representation list of key/value pairs. It can be the entire JSON or just a portion specified by the Path.
The action "JSON_Listify" is used to replace JSON attributes into a key/value JSON objects object in the resulting JSON.
It can be the entire JSON or just a portion specified by the Path.
Create a server action and call the "JSON_Listify" action, as can be seen in the picture below as a sample.
Fill the input parameter "JSONIn" with the JSON to process and the parameter "Path" with the path to retrieve ( for the Path expressions please refer to the "JSONSelect" documentation).
As the result of this transformation now you only have the original JSON with the attributes replaced as "key/value" objects for the path selected.
How to use the "JSON_Objectify" action
The next steps will guide you on how to use this component. In the end, you should have an action that allows the replacement of the key/value attributes of the original JSON into JSON objects from those attributes. It can be the entire JSON or just a portion specified by the Path.
The action "JSON_Objectify" is used to replace attributes called key and value into a key/value object in the resulting JSON.
Create a server action and call the "JSON_Objectify" action, as can be seen in the picture below as a sample.
As the result of this transformation now you only have the original JSON with the attributes called "key" and "value" replaced as an object where the key is the object key, and the value is the object value for the path selected.