Converting JSON string from an API response to a flow service document type
Know how to convert JSON string from an API response to a flow service document type.
About this task
Understand how to convert JSON string from an API response to a flow service document type.
Procedure
- In the flow editor, select the flow function Client service to invoke an HTTP service to submit a HTTP request to retrieves results from the third-party API endpoints.
- Use the bytesToString service to convert the HTTP response from bytes to a string.
- Select the flow function JSON and use the
jsonToDocument service to convert the JSON to a
document. The document is ready for use as it is parsed, structured and accessible via pipeline variables.
- Add Transform Pipeline to group the variables that you want to send in a response and drop all unwanted variables.
- Run the flow service. The result is a document containing data received from a third-party API, transformed from raw byte data into a JSON format and then into the expected output document for further use.