Reputation: 832
I execute an xpath function in my Logic App to set the value of a variable. The result is a guid and the variable is formatted as [""]. I want to use this variable in a body message sent to an http endpoint and when I use the variable content, it sent the [""] but I need just to send the . I'm a bit lost here because I don't know how to extract only the Json value of this variable... Thanks.
Upvotes: 1
Views: 1832
Reputation: 23
when you need only one value without any filters this will work. document_url: is the XML tag, here the path to the node is not required.
xpath(xml(Body()),'//document_url/text()') ------- returns all the values
xpath(xml(Body()),'//document_url/text()')[0] ------ returns only the first value
Upvotes: 0
Reputation: 1466
The result of the xpath function is a json array of XML nodes matching your xpath expression. If you are only expecting a single node, you can use the @first
function to reference it
"@first(xpath(...))"
Upvotes: 3