How to call Json objects dynamically?

Posted by Devyn on Stack Overflow See other posts from Stack Overflow or by Devyn
Published on 2010-05-14T00:36:08Z Indexed on 2010/05/14 0:44 UTC
Read the original article Hit count: 346

Filed under:
|

Hi, I have like this

var house = {'floor':{'one':'3 people','two':'1 people'}}
var tmp = 'one';

and I want to call like this..

console.log(house.floor.tmp) // expecting '3 people' result

tmp value will get from somewhere dynamically but it's not working. How can I solve this?

© Stack Overflow or respective owner

Related posts about JSON

Related posts about JavaScript