fcsonline/drill

How to get a single field inside an array of assign?

LJason77 opened this issue · 4 comments

I have json:

{
    "count": 2,
    "rows": [
        {
            "_id": "aaa",
            "name": "AAA"
        },
        {
            "_id": "bbb",
            "name": "BBB"
        }
    ]
}

and benchmark.yml:

- name: get all
  request:
    url: /get_all
  assign: all

I want to get a single id, for example, this kind of:

- name: delete
  request:
    url: /del/{{ all.body.rows[0]._id }}
    method: DELETE

The above code is not working, what should I do?

Nowadays, the json access for previous requests doesn't support array steps. But it could be a really nice addition

Maybe this merge can help you with more complex json accesses: #114

olka commented

Executing OS commands to parse json in every request would be a performance killer.

Is there a way to implement this feature or there is a design complications that prevent this?

Not super complicated, but it needs to be implemented.