How to access keys and values, in object variables

Sometimes we might need to store full responses from our your HTTP Request, that might have the shape like below:

{    
"product":"T-shirt",
"price":"$1.00",    
"color":"Blue"
}

Let's say that we have this object, stored in a variable called @item . To access the value of the key "price" and store it in a new variable called @item_price, we will need to do it like in the example below:

@{item.price | default:"X"}

In case we want to access an Array, we need to do it like this example:

[
{ "product":"T-shirt", "price":"$1.00", "color":"Blue" },
{ "product":"Jeans", "price":"$9.50", "color":"Black" }
]

Then to access the second object, the key price will be like this:

@{payload.0.outputContext | default:"X"}


How did we do?


Powered by HelpDocs

Powered by HelpDocs