Ask a Question

Property transfer using JSON nodes count

ReshmaSachdev
Contributor

Property transfer using JSON nodes count

How to perform property transfer to keep track on no of nodes returned in JSON response:

eg:

 

{
     "firstName": "John",
     "lastName" : "doe",
     "age"      : 26,
     "address"  :
     {
         "streetAddress": "naist street",
         "city"         : "Nara",
         "postalCode"   : "630-0192"
     },
     "phoneNumbers":
     [
         {
           "type"  : "iPhone",
           "number": "0123-4567-8888"
         },
         {
           "type"  : "home",
           "number": "0123-4567-8910"
         }
     ]
 }

here for phoneNumbers we have 2 nodes.

 

 

4 REPLIES 4
TanyaYatskovska
SmartBear Alumni (Retired)

Hi ReshmaSachdev,

 

I suggest that you review the following article: http://readyapi.smartbear.com/structure/steps/property/transfer/example

It contains a great example of how to transfer property values in your project.

 

Does it help?

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



I have been using property transfer step using xpath to 'count' no of nodes, but with JSONPath there is no reference given.

@ReshmaSachdev 

 

Sorry for delay response.

select property transfer as "ResponseAsXml" then Path Language as "XPath"

${#ResponseAsXml#count(//*:number)}

 

Hope this will Help?

 

Ashoob.

 

Olga_T
SmartBear Alumni (Retired)

Thanks for sharing, @pak2redy!


Olga Terentieva
SmartBear Assistant Community Manager

cancel
Showing results for 
Search instead for 
Did you mean: