Xpath - Extract element based on other element in the JSON response

BaahubaliBaahubali Posts: 14

I have a JSON response with following structure which is dynamic. I want to extract the account balance to a data bank of specific person eg:John

"Details" : [
{
"AccountBalance" : "6793",
"Person" : "John"
},
{
"AccountBalance" : "3646",
"Person" : "Peter"

Comments

  • jakubiakjakubiak Posts: 691 admin

    Try an XPath like the following in your JSON Data Bank: /root/Details/item[Person/text() = 'John']/AccountBalance/text()

  • BaahubaliBaahubali Posts: 14

    That worked. Thanks a lot!

Sign In or Register to comment.