Extract Variable JSON payload nodeset introducing escape characters

Not applicable

Hi,

I am using Extract Variable policy to extract a node-segment and then add it to another json. I am achieving this using type=nodeset . However, I see some escape characters introduced when inserting the node-segment in the other json.

Here is what I am doing:

Extract Variable policy

    <JSONPayload>
       <Variable name="custom-tags" type="nodeset">
          <JSONPath>$.user.custom-tags</JSONPath>
       </Variable>
    </JSONPayload>

I am then adding the node segment extracted to the larger JSON. But here is how the output is coming:

"custom-tags": "{\"appes\":[{\"Id\":\"ma\",\"Id\":\"23456\"},{\"pId\":\"dummy\",\"name\":\"some name\"}]}"

Where are the escape characters coming in from? How do I get rid of it?

Update: I have posted another question here. I believe these 2 are related.

1 3 1,453
3 REPLIES 3

HI @Ritwik Chatterjee - how are you adding this extracted segment to the larger JSON ? Using javascript policy ?

Not applicable

@Sai Saran Vaidyanathan

I am actually using an OAuthV2 policy - to set custom attributes. I guess the issue might be in the OAuthV2 policy. See my related question here.

The custom attributes you have attached are a JSON hash. Edge is serializing that to a string, via JSON.stringify(). Upon retrieval you must convert it back to a JSON hash, with JSON.parse().