# Indirectly Address data in an OBJECT

**URL:** <https://forum.code.org/t/indirectly-address-data-in-an-object/35952>\
**Category:** Website and Tools Questions\
**Created:** [March 1, 2022, 4:08pm UTC](https://forum.code.org/t/indirectly-address-data-in-an-object/35952 "2022-03-01T16:08:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathytechy](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@mathytechy](https://forum.code.org/u/mathytechy)\
**Post date:** [March 1, 2022, 4:08pm UTC](https://forum.code.org/t/indirectly-address-data-in-an-object/35952/1 "2022-03-01T16:08:33Z")

</div>

I am fetching exchange rate data using startWebRequest. Then I use JSON.parse(content) to organize the data. I want to be able to indirectly address the Rates.data.xxx part of the object.  
For example, if I want to know the exchange rate for USD I would have to look at the object like this:

Rates.data.USD

something like  
var x = “USD”  
Rates.data.x??? That does not work.

But I want the USD part to be controlled by a variable so I can ask for the exchange rate of any country I choose.  
Any suggesitions?

[https://studio.code.org/projects/applab/WGuDvWmXX\_KEK0DLsUjHa4ORVZyFmAmC78ywW4IdvBg](https://studio.code.org/projects/applab/WGuDvWmXX_KEK0DLsUjHa4ORVZyFmAmC78ywW4IdvBg)

Alternately, how can I pick out specific countries info from the raw data returned from the startWebRequest command? Any ideas are appreciated.

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [March 2, 2022, 3:10pm UTC](https://forum.code.org/t/indirectly-address-data-in-an-object/35952/2 "2022-03-02T15:10:57Z")

</div>

Have you tried `Rates.data[x]`.

---

<div class="post-metadata">

**Author:** ![mathytechy](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@mathytechy](https://forum.code.org/u/mathytechy)\
**Post date:** [March 2, 2022, 3:47pm UTC](https://forum.code.org/t/indirectly-address-data-in-an-object/35952/3 "2022-03-02T15:47:36Z")

</div>

Wow…yes it was that simple. I tried many different notations but not that one.  
Thanks a lot.
