Forum Discussion

Yuriy_Babay's avatar
Yuriy_Babay
New Contributor
6 years ago
Solved

How to get all the ID's one by one

Hi all, I have next task and understand that I need a groovy script for this. I have next response with a few countries:    { "id" : "ABW", "iso2Code" : "AW", "name" : "Aruba", "region" : { "...
  • richie's avatar
    6 years ago

    Hi,

     

    Are you saying you have a variable number of 'id' attributes in your response or are they a fixed number?

     

    You don't necessarily need groovyscript for this - unless you haven't got the Pro version??  Which version are you using?

     

    Also - it's difficult to provide the relevant jsonpath as you .json is actually malformed.  

     

    Can you provide the wellformed .json?   It looks like you just copied in the objects corresponding to a single record and added in a comma and copied in the objects to a second record but this returns malformed .json so it'll never work anyway.

     

    Once we've got the wellformed json - it'll be a lot easier to give you the jsonpath you need I suspect - although I always struggle with jsonpath relative to xpath.

     

    thanks,

     

    richie