Ask a Question

API Automation jsonpath node issue

SOLVED
Sandyapitester
Frequent Contributor

API Automation jsonpath node issue

Hi All

 

SOAPUI PRO

 

API response has

[ { "username": "xyz", "password": "1234",

},

{ "username": "null", "password": "12344", },

{ "username": "AB1", "password": "123411", },

{ "username": "null", "password": "1234111", },

  {
  "username": "null",
  "password": "123",

} ]

Json node

JSON

• 0

• 1 

• 2 

• 3 

• 4

 

Now am trying to get the username from all the record which should not null

$.[*].[?(@.username)] And $..[?(@.username)]

Both assertion is not working

 

Guide me if u have a solution

3 REPLIES 3
HKosova
SmartBear Alumni (Retired)

Your JSON is not valid -- it has extra commas before }. Assuming these are just typos, the following should work:

$[?(@.username != "null")].username 

Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Sandyapitester
Frequent Contributor

Hi Bro,

 

Extra commas before }. is not a typo error. that the way getting the response.

 

I tired with the below assertion

 

$[?(@.username != "null")].username 

 

It's not working.. any other way to fix this issue

 

 

Hi Bro,

 

ur right it's  a typo error. thanks for the information and great support

 

 

cancel
Showing results for 
Search instead for 
Did you mean: