<p>Well that depends on what language you are using to parse the JSON. </p>

<p>The output for the API is in JSON format (JavaScript Object Notation). This notation is very common in the API space and when reading raw bitcoin transactions and blockchain data. When you query address information in bitcoin core console it is in JSON format. Think of it as a set of arrays. If you have an array of "Food" and that array contains "Fruit", "JunkFood", and "Snacks", and each of these arrays contain additional values within them. So if you wanted to access "apple" it would be under Food -> Fruit -> Apple. </p>

<p>With the BTC-e API JSON response it gives you the category first of "btc_usd" and then within that array is "high", "low", "avg", "last", etc. So in order to only select "last" it would be under btc_usd -> last.  </p>

<p>I typically use PHP and it's quite simple to do. 
Here's a phpfiddle: <a href="http://phpfiddle.org/lite/code/jsah-t4dv" rel="nofollow">http://phpfiddle.org/lite/code/jsah-t4dv</a></p>

<pre><code>&lt;?php
$url = "https://btc-e.com/api/3/ticker/btc_usd";
$decode = json_decode(file_get_contents($url), true);
$price = $decode["btc_usd"]["last"];
echo $price;
?&gt;
</code></pre>

CC BY-SA 3.0
2015-10-25T16:19:37.557Z
Thank you very much for your detailed and informative answer. Not only do i know how to do it now, i also know what i am doing because of your explanation. Thanks
Z3br3
CC BY-SA 3.0
2015-10-25T16:23:38.970Z
@Z3br3 You're welcome! Please consider marking my response as the correct answer :)
m1xolyd1an
CC BY-SA 3.0
2015-10-25T15:39:24.053Z
2015-10-25T15:56:01.377Z
2015-10-25T15:56:01.377Z
m1xolyd1an
<p>how will i be able to get a single value out of BTC-e API.
This is the current API: </p>

<p><a href="https://btc-e.com/api/3/ticker/btc_usd" rel="nofollow">https://btc-e.com/api/3/ticker/btc_usd</a></p>

<p>As you can see, it shows lots of information. What can i do so that i will only get<br>
  --> "last":284.323 &lt;--    this number?</p>

<p>Thank you!</p>

<api><btce>
How to get a single value in BTC-e API
Z3br3
# How to get a single value in BTC-e API

(Asked by: username_0 on 2015-10-25)

how will i be able to get a single value out of BTC-e API.
This is the current API:

<https://btc-e.com/api/3/ticker/btc_usd>

As you can see, it shows lots of information. What can i do so that i will only get  
--> "last":284.323 <-- this number?

Thank you!

**Tags:** api, btce


---

## 1 answers

### Answer by username_1 on 2015-10-25. Score: 1 | Accepted answer

Well that depends on what language you are using to parse the JSON. 
The output for the API is in JSON format (JavaScript Object Notation). This notation is very common in the API space and when reading raw bitcoin transactions and blockchain data. When you query address information in bitcoin core console it is in JSON format. Think of it as a set of arrays. If you have an array of "Food" and that array contains "Fruit", "JunkFood", and "Snacks", and each of these arrays contain additional values within them. So if you wanted to access "apple" it would be under Food -> Fruit -> Apple. 
With the BTC-e API JSON response it gives you the category first of "btc_usd" and then within that array is "high", "low", "avg", "last", etc. So in order to only select "last" it would be under btc_usd -> last.  
I typically use PHP and it's quite simple to do. 
Here's a phpfiddle: http://phpfiddle.org/lite/code/jsah-t4dv

> **Comments:**
> **username_0**: Thank you very much for your detailed and informative answer. Not only do i know how to do it now, i also know what i am doing because of your explanation. Thanks  
> **username_1**: @username_0 You're welcome! Please consider marking my response as the correct answer :)  

---

