hurl icon indicating copy to clipboard operation
hurl copied to clipboard

Can you output certain fields in JSON format to output?

Open baerwang opened this issue 1 year ago • 2 comments

Problem to solve

Create tokens and deliver them to different hurl dependencies

get token

GET {{host}}/v1/integration/register
[Options]
output: integration_output
HTTP 200
[Captures]
token: jsonpath "$.result.token"

api response

{"token":"secret"}

integration_output file

token: secret

use hurl command execute next.hurl

hurl --test --error-format long --variables-file integration_output next.hurl

next.hurl

GET {{host}}/v1/integration
Authorization: Bearer {{access_token}}
HTTP 200

Proposal

Additional context and resources

Tasks to complete

  • [ ] ...

baerwang avatar Jun 28 '24 16:06 baerwang

Hi @baerwang

Would it be possible to use --jsonoption and piping the output with jq for instance to extract captured variables? I have the impression that it could address your needs.

jcamiel avatar Jun 28 '24 16:06 jcamiel

Hi @baerwang

Would it be possible to use --jsonoption and piping the output with jq for instance to extract captured variables? I have the impression that it could address your needs.

I think hurl could consider adding json parse,jq reduces development efficiency

baerwang avatar Jun 28 '24 22:06 baerwang

Hi @baerwang

I'm closing this issue, I've the impression that we can do what we want with --json.

Regards,

jcamiel avatar Jul 11 '24 14:07 jcamiel