Nisri
Nisri

Reputation: 15

Logic apps: How to add root node in JSON variable?

I am trying to do the following:

@xml(json(concat('\\"rootnode\\":',variables('TestJSON'))))

However the error I am getting is :

InvalidTemplate. Unable to process template language expressions in action 'Set_XXXXXXX' inputs at line '1' and column '1873': 'The template language function 'json' parameter is not valid. The provided value '\"rootnode\":.......... cannot be parsed: 'Unexpected character encountered while parsing value: \. Path '', line 0, position 0.'.

Looks like escape character is not working in Logic Apps? Any suggestions?

Upvotes: 1

Views: 488

Answers (1)

Frank Borzage
Frank Borzage

Reputation: 6796

Please use this expression:

xml(json(concat('{"rootnode":',variables('TestJSON'), '}')))

enter image description here

Upvotes: 1

Related Questions