0
votes

I'm trying to filter this JSON by green vegetables :

[
    {
        "vegetable": {
            "name": "peas",
            "color": "green"
        },
        "meet": {
            "name":"beef",
            "color":"red"
        }
    },
    {
        "vegetable": {
            "name": "potato",
            "color": "yellow"
        },
        "meet": {
            "name":"lamb",
            "color":"brown"
        }
    }
]

with a JSONPath with gatling like

val searchGreenVegetable = exec(http("Search green vegetable")
                                  .get("http://myUrl/json/")
                                  .check(jsonPath("""$..vegetable[?(@.color=="green")]""").exists)
                           )

but I always have the "found nothing" error in the gatling report.

2

2 Answers

1
votes

Your expression is correct, this was indeed a bug. It's fixed in 0.6.3 that was just released.

Thanks for reporting.

0
votes

Try this:

val searchGreenVegetable = exec(http("Search green vegetable")
                                  .get("http://myUrl/json/")
                                  .check(jsonPath("$..vegetable[?(@.color=='green')]").exists)
                           )