question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: how to transform response variables nicely?

See original GitHub issue

Issue Description

I’m looking for a nice way (one-liner?) how to transform/extract data from a response into a variable. Example

### Foos
# @name foos
GET /v1/foos

returns:

{
 "items": [
    { 
       "id": 1
    }
  ]
}

Now I want to continue with the first object in the array:

### Foo
# @name foo
GET /v1/foos/{{foos.items[0].id}}

This is ok, but I want to apply foo in multiple requests and, given a larger array switch to another array index. So I have in mind that AFTER the response I store the object in foo and can continue:

### Foos
# @name foo
GET /v1/foos

{{exports.foo =  foos.items[0].id}}

But this doesn’t work as it’s taken a request body. Any idea how to solve this nicely?

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:28 (28 by maintainers)

github_iconTop GitHub Comments

1reaction
rngtngcommented, Apr 3, 2022

btw. just bumped my files & plugins to latest version. It a looks good now, the response var transform makes it soooo nice! thx

1reaction
rngtngcommented, Apr 1, 2022

thanks for the fix/feature. will test it. Still unsure if == syntax is best choice as used as comparison in other languages. what’s the difference of @slideshow=={{response.parsedBody.slideshow}} and @slideshow={{response.parsedBody.slideshow}} then. First works, second is still cast to string?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lesson 7: Transformations & Interactions | STAT 462
Transforming response and/or predictor variables therefore has the potential to remedy a number of model problems. Such data transformations are the focus ...
Read more >
When and How Should I Transform my Response Data?
In this blog we will explain when you should consider transforming the response, and how to choose a response transformation.
Read more >
Understanding the transformation on response variable
I'm working with regression models, attempting to understand transformations a bit more. I'm modeling (Y~X) and I get an R2 of 0.4. I...
Read more >
Data Transformation
We will address transformation to meet the homogeneity of variance assumption momentarily (even though it is best to conduct the variance transformation first, ......
Read more >
A guide to Data Transformation - Medium
Improve interpretability. Some variables are not in the format we need for a certain question, e.g. car manufactures supply miles/gallon values ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found