cancel
Showing results for 
Search instead for 
Did you mean: 

Json Path Match doesn't give the right answer

SOLVED
Highlighted
New Contributor

Json Path Match doesn't give the right answer

My JSON response is

 

{"topics": [
[
{
"topicId": 930,
"title": "Title zu 930",
"countNew": 0,
"marked": false,
"imageLink": "https://intwbp3.weka-business-portal.de/api/1.0/documentdownload/modules/PI01/downloads/binary/931",
"description": "Kurze Beschreibung zum Thema 930",
"topicLink": "https://intwbp3.weka-business-portal.de/wekapilot/PI01/themen/930",
"topicDescriptionLink": "https://intwbp3.weka-business-portal.de/wekapilot/PI01/dokumente/930",
"documents": [ {
"title": "Klassifizierung gefährlicher Güter",
"genre": "Lexikonstichwort",
"genreCluster": "Thema",
"objectId": 918,
"link": "https://intwbp3.weka-business-portal.de/wekapilot/PI01/dokumente/918",
"new": false
}]
},
{
"topicId": 902,
"title": "Textilabfälle, Abfälle der Lederindustrie, Abfälle bei der Gummiherstellung",
"countNew": 2,
"marked": true,
"imageLink": "https://intwbp3.weka-business-portal.de/api/1.0/documentdownload/modules/PI01/downloads/binary/903",
"description": "Unter Textilien versteht man linien-, flächenförmige und räumliche Gebilde, die aus textilen Rohstoffen (Naturfasern, Chemiefasern) hergestellt und weiterverarbeitet sind. Textilabfälle fallen in der gesamten Wertschöpfungskette an.Leder wird durch Gerben (Haltbarmachen) von Fellen und Häuten von Haustieren und wild lebenden Tieren hergestellt. Die Gerbung kann mit vegetabilen oder mineralischen Gerbmitteln erfolgen. Allerdings sind die Stoffe, die als Abfall aus der Gerberei entsorgt werden müssen, minimal.Gummi ist der Überbegriff für elastomere Werkstoffe, die durch Vulkanisation ... ",
"topicLink": "https://intwbp3.weka-business-portal.de/wekapilot/PI01/themen/902",
"topicDescriptionLink": "https://intwbp3.weka-business-portal.de/wekapilot/PI01/dokumente/902",
"documents": [
{
"title": "Zusammenfassende Darstellung der Abfälle der Textilindustrie",
"genre": "Fachbeitrag",
"genreCluster": "Beitrag",
"objectId": 810,
"link": "https://intwbp3.weka-business-portal.de/wekapilot/PI01/dokumente/810",
"new": false
},
......

}
]
]}

 

I have to test the value "countNew: 2" from topicId "902" - just good to know: the sequence of the topicIds change with every run! So I can't test the countNew with >>$.topics.[0]topicId.[1]<< for example

 

So I have a JSON Path Assertion:

>>$.topics[*][?(@.topicId==902)].countNew<< -> in SoapUi the answer is 0 (wrong)

 

If I test this assertion on http://jsonpath.herokuapp.com/ - the answer is "2" (correct)

 

What is the difference in SoapUi? How should I change my assertion?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
New Contributor

Re: Json Path Match doesn't give the right answer

3 REPLIES 3
Highlighted
Community Hero

Re: Json Path Match doesn't give the right answer

Can you validate your json path for your json string using below url and see what you state is correct?
https://jsonpath.com/


Regards,
Rao.
Highlighted
New Contributor

Re: Json Path Match doesn't give the right answer

Highlighted
Community Hero

Re: Json Path Match doesn't give the right answer

Do you think the below works for you?

 

nmrao_0-1589281572196.png

 



Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors