Manipulate json response body from API consumption
Application Type
Traditional Web, Reactive

Hi all,

Is there a way to manipulate the data returned from consuming an API? Basically I am utilising bitbucket API to retrive the file contents of the files in a repository. However given the nature of the files (mostly text files), the API is returning the contents as a string hence when i consume the API in outsystems, outsystems does not recognise this format.

The file contents (by each line) :

a=200

b=300

The data returned by the API :

"a=200\n b=300"


 Is there away I can process the contents to json in outsystems into this format ?:

{ 'a': 200, 'b' = 300}


Hi Shum,

You can use Rest API On After Response event to modify your API response text. In this event you can apply your custom logic to change the response text as per your requirements.

For more details please check below link -

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/REST/Consume_REST_APIs/Simple_Customizations

Thanks

Vinod

Hi Vinod

My response is a text (refer to image) , is there anyway i can convert it to a json object? The link you provided me manipulates response that are already in json object which does not apply to me in that case

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.