Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

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

anusha
anusha 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_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    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()

  • anusha
    anusha Posts: 13

    Thank you, i will try the xpath