title: Apply filter to JSON.parse() dynamically
body: <p>I have the following js:</p>
  
  <pre><code>var text = '{"firstName" : "abc", "lastName" : "def", "age" : 25}';
  obj = JSON.parse(text).firstName;
  console.log(obj);
  </code></pre>
  
  <p>This prints the value corresponding to the key firstName as expected. However what I am trying to do is, I want to store the key to be fetched in a variable and use it along with JSON.parse() statement. Something like this:</p>
  
  <pre><code>var text = '{"firstName" : "abc", "lastName" : "def", "age" : 25}';
  var filter = 'firstName';
  obj = JSON.parse(text).filter;
  console.log(filter)
  console.log(obj);
  </code></pre>
  
  <p>This code prints 'undefined' onto the console. What am i doing wrong?</p>