validate id in json response and pull the details associated with the id into the report

anushaanusha Posts: 13

Hi,
Below is my scenario, i have json response in json databank, based on object id i want to pull the details like:
if id :2
{
name:test
number:1
}
so based on id i want to pull the name and number into report.

Comments

  • benken_parasoftbenken_parasoft Posts: 463 ✭✭✭

    An example JSON array, based on what you seem to describe:

    [
      {
        "id" : 1,
        "name" : "john",
        "number" : 123
      },
      {
        "id" : 2,
        "name" : "jane",
        "number" : 456
      },
      {
        "id" : 3,
        "name" : "joe",
        "number" : 789
      }
    ]
    

    Name for id 2 would be: /root/item[id='2']/name/text()
    Number for id 2 would be: /root/item[id='2']/number/text()

  • anushaanusha Posts: 13

    Thank you, i will try the xpath

Sign In or Register to comment.