Question: How can I get a certain value from the following API result:

```js
{
    "status": "success",
    "data": {
        "prices" : [
            {
                "market_hash_name": "Glock-18 | Catacombs (Minimal Wear)",
                "price": "0.08"
            }
        ]
    }
}

```

I am trying to extract the price value which in this case is 0.08 and put it in the variable $lowest\_price. This is the code I came up with:

```php
$obj = json_decode($json);
if($obj->{'status'} == "fail") die("notfound");
$lowest_price = $obj->data->prices->price;
$lowest_price = (float)($lowest_price);

```

Thanks.

Answer: 
Here you have it:

```
$lowest_price = $obj->data->prices[0]->price

```
```
$obj = json_decode($json);
if($obj->{'status'} == "fail") die("notfound");
$lowest_price = $obj->{'data'}->{'prices'};

//$lowest_price is now an array
// for multiple values:
foreach($lowest_price as $value)
{
    $price = (float)$value->{'price'};
}

// For a single value:
$price = (float)$lowest_price[0]->{'price'};

```