cancel
Showing results for 
Search instead for 
Did you mean: 

Property transfer using JSON nodes count

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
Community Manager

Re: Property transfer using JSON nodes count

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 Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Contributor

Re: Property transfer using JSON nodes count

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

New Member

Re: Property transfer using JSON nodes count

@ReshmaSachdev 

 

Sorry for delay response.

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

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

 

Hope this will Help?

 

Ashoob.

 

Moderator

Re: Property transfer using JSON nodes count

Thanks for sharing, @pak2redy!


Olga Terentieva
SmartBear Assistant Community Manager