Filter json output in azure synapse-pipeline?

I’m creating a Pipeline in Azure Synapse Analytics using the synapse pipeline to get the content of a Rest-API call. Before the call I have to get the bearer token. While using the web activity to get the bearer token for an Rest-API Call, I get the bearer token in a format like {"access_token":"Sample-Bearer-Token","token_type":"bearer","expires_in":999999}.

I would like to only get the content from "access_token", in order to pass it for the REST-API Call. It seems like I can get the whole output of the web activity with @activity('Web1').output but how can I filter the json output in a synapse-pipeline to only get the bearer token?

Best regards and thanks!

>Solution :

You can reference key name value pairs in json using the dot syntax, so something like this should work for you:

@activity('Web1').output.access_token

You could assign this to a variable using the Set Variable activity for testing or just use it directly in the next activity.

Leave a Reply