Orange-OpenSource / hurl

Hurl, run and test HTTP requests with plain text.
https://hurl.dev
Apache License 2.0
12.89k stars 482 forks source link

jsonpath: indexing inside of Filter expression does not work #2944

Open mateusz834 opened 3 months ago

mateusz834 commented 3 months ago

Consider following json:

{
  "rows": [
    {
      "id": 612290,
      "cells": [
        {
          "value": 612290
        },
        {
          "value": "test@example.com"
        }
      ]
    },
    {
      "id": 609759,
      "cells": [
        {
          "value": 609759
        },
        {
          "value": "test@example.coml"
        }
      ]
    }
  ]
}

and jsonpath:

$.rows[?(@.cells[1].value == 'test@example.com')].id

It fails with an error: the JSONPath expression '$.rows[?(@.cells[1].value == 'test@example.com')].id' is not valid

It works in https://jsonpath.com/

fabricereix commented 3 months ago

Thanks @mateusz834 for your issue. JSONPath scripts in filters are still work in progress in the spec. https://www.ietf.org/archive/id/draft-goessner-dispatch-jsonpath-00.html#name-detailed-definition. We are going to look into it to see if Hurl can support it.