'json' parameter is not valid after updating secret key in ADF web activity

Anneka Osmun 0 Reputation points
2025-03-20T15:33:29.6633333+00:00

Hello,

We have a pipeline with two web activities:

  1. The first retrieves a secret key from the key vault.
  2. The second uses that secret key to obtain a bearer token.

Recently, we updated the expired secret key retrieved in the first web activity. The only change we made was updating the URL to fetch the new secret key from the key vault, everything else about the web activity remained the same.

However, the second web activity, which uses the secret key to get a bearer token, is now failing with the following error:

Error: The function 'json' parameter is not valid. The provided value 'examplesecretkey' cannot be parsed: 'Unexpected character encountered while parsing value: x. Path '', line 0, position 0

Since the only change was updating the link to the new secret key in the key vault, why is the second web activity unable to process it?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,582 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. J N S S Kasyap 3,300 Reputation points Microsoft External Staff Moderator
    2025-03-20T18:05:03.51+00:00

    Hi @Anneka Osmun

    The error message indicates that the json function in ADF is being used in the second web activity to interpret the output of the first web activity (the secret key). The json function expects a valid JSON string, such as {"key": "examplesecretkey"}, but it’s receiving something it can’t parse likely a plain string like examplesecretkey resulting in the parsing failure

    The second web activity is likely using an expression like @json(activity('FirstWebActivity').output) to parse the output of the first activity, expecting a JSON object (e.g., {"value": "examplesecretkey"}). However, if the first activity’s output is now returning the secret key as a plain string (examplesecretkey) instead of a JSON structure, the json() function will fail because it can’t parse a non-JSON string.

    The possible below scenarios:

    If the first activity’s output is a JSON object with a value property (e.g., {"value": "examplesecretkey"}), update the second activity to reference it correctly

    @activity('FirstWebActivity').output.value
    

    If the output is a plain string, remove the json() function from the expression in the second activity.

    @activity('FirstWebActivity').output
    

    I hope this information helps. Please do let us know if you have any further queries.

    Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.

    Thank you.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.