1

I am trying to test HTTP responses with Thunder Client in VS Code. The HTTP response I get is:

{
    "currencies": [
        {
            "name": "Btc",
            "count": 17
        },
        {
            "name": "Ltc",
            "count": 0
        }
    ]
}

My goal is to test count field in each of the item in the array bases on some condition/filter. The test option I want to use is JSON Query. I tried with json.currencies[name='Btc'].count query, but the response is:

Query: json.currencies[name='Btc'].count > 0 => Actual: undefined

How can I check some property with specific conditions inside of the array?

Rok
  • 451
  • 3
  • 21

3 Answers3

0

In Thunder Client you can access response array element using index.

so use json.currencies[0].count

Ranga Vadhineni
  • 349
  • 2
  • 13
0

With the version 1.18.3 filtering by property content was introduced.

Rok
  • 451
  • 3
  • 21
0

No need of quotes around Btc

json.currencies[name=Btc].count

Ranga Vadhineni
  • 349
  • 2
  • 13