cancel
Showing results for 
Search instead for 
Did you mean: 

JsonPath count of embedded node

SOLVED
WillJones
New Contributor

JsonPath count of embedded node

"Hi I am trying to count the occurences of an embedded node using Json Path Count assertion.

My Json response looks something like this..

{
"logs":[{"logId" : 1234,
            "childLogResponse": [ {"logId": 3085031}]
          }]
}

 

How do I count the number of childLogResponse or match that the childLogResponse logId is a certain ID?

In my JSONPath Expression if I type "logs" and hit Select from current it returns an expected Result 1. If I type "childLogResponse" it returns No match in current response.

If I try "logs.childLogResponse" or "$.logs.childLogResponse" it returns Invalid JsonPath expression.

Many thanks in advance for any help. 

1 ACCEPTED SOLUTION

Accepted Solutions
nmrao
Community Hero

Re: JsonPath count of embedded node

Am not aware of jsonpath. Here is a similar solution done using groovy script. Take a look if you wish.

http://stackoverflow.com/questions/35623183/soapui-how-to-find-node-count-in-json-response/35626696#...



Regards,
Rao.

View solution in original post

1 REPLY 1
nmrao
Community Hero

Re: JsonPath count of embedded node

Am not aware of jsonpath. Here is a similar solution done using groovy script. Take a look if you wish.

http://stackoverflow.com/questions/35623183/soapui-how-to-find-node-count-in-json-response/35626696#...



Regards,
Rao.

View solution in original post

New Here?
Join us and watch the welcome video:
Top Kudoed Authors