Hello @sachin gupta and welcome to Microsoft Q&A.
If you just want to replace \"
with "
, then you can use the below:
replace(pipeline().parameters.input,'\"','"')
However I suspect you also want to read it as JSON not text, in which case you need:
@json(replace(pipeline().parameters.input,'\"','"'))
Do note that foreach expects an array at some point.
sometimes @json
alone is enough to remove escape characters.
For extracting the xxx
, I notice you have two sets of xxx
in the id attribute. I am assuming you only want the last one, the one following /secrets/ .
----------
Given sample data:
[
{\"id\":\" https://abc.vault.azure.net/secrets/abc \",\"attributes\":{\"enabled\":true,\"nbf\":1632075242,\"created\":1632075247,\"updated\":1632075247,\"recoveryLevel\":\"Recoverable+Purgeable\"},\"tags\":{}},
{\"id\":\" https://xyz.vault.azure.net/secrets/xyz \",\"attributes\":{\"enabled\":true,\"nbf\":1632075242,\"created\":1632075247,\"updated\":1632075247,\"recoveryLevel\":\"Recoverable+Purgeable\"},\"tags\":{}}
]
and ForEach items expression:
@json(replace(pipeline().parameters.sample_data,'\"','"'))
and a Set Variable activity inside the loop with expression:
@substring(item().id,
add(lastindexof(item().id,'/'),1),
sub(length(item().id), add(lastindexof(item().id,'/'),1))
)
I get outputs abc , xyz