0

In Selecting/filtering with JSON Query the OP reported a similar problem to mine. In my case i have this json response

{
  "status": "ok",
  "featuresSelected": [
    {  "feature": "x1", "price": "1.23" },
    {  "feature": "u7", "price": "4.56"},
    ... many more 
   ]
}

I want to check if the price of u7 is 4.56. This is my line

json.featuresSelected[feature=u7].price equal 4.56

// changing it to 
json.featuresSelected[feature=u7].price equal "4.56"
// or
json.featuresSelected[feature="u7"].price equal 4.56
// or
json.featuresSelected[feature="u7"].price equal "4.56"

returns the same result.

But i get:

Query: json.featuresSelected[feature=u7].price equal to 4.56 => Actual: undefined.

Any ideas what i am doing wrong?

Versions

I updated to

  • thunder-client 1.20.1
  • Visual Studio Code Version: 1.71.2
surfmuggle
  • 5,527
  • 7
  • 48
  • 77

1 Answers1

0

With another api a query as the following is working

json.products[name=Oranges].product_url equals /shop/products/10
json.products[name=Pineapples].product_url equals /shop/products/33

This is the tested endpoint

curl -X GET \
  'https://api.predic8.de/shop/products/' \
  --header 'Accept: */*' \

This returns a json like this


{
  "meta": { "count": 32, "limit": 10, "page": 1
                  , "next_url": "/shop/products/?page=2&limit=10" }
  , "products": [
    { "name": "Oranges", "product_url": "/shop/products/10" },
    { "name": "Pineapples", "product_url": "/shop/products/33" }
 ]
}

The test is working as expected

// returns pass as expected
json.products[name=Apple].product_url equals /shop/products/18

// returns fail as expected
json.products[name=Apple].product_url equals /shop/products/7

It is also working in our internal api.

surfmuggle
  • 5,527
  • 7
  • 48
  • 77