title: How to fetch data from JSON object in JavaScript?
body: <p>I am working on SpringMVC. In my controller I create a JSON object and I pass that object to JavaScript. How can I read that object in JavaScript?</p>
  
  <p>My <code>Map</code> object</p>
  
  <pre><code>Map&lt;String rootNode,List&lt;String&gt;&gt; map = new HashMap&lt;String rootNode,List&lt;String&gt;();
  String rootNode = "bhanu";
  ArrayList&lt;String&gt; al = new ArrayList&lt;String&gt;();
  for( int i = 0; i &lt; UserProfile.size; i++ ) { 
      al.add( userProfile.get( i ) );
  }
  map.put( userProfile, al );
  </code></pre>
  
  <p>At last my <code>Map</code> object has this data:</p>
  
  <pre><code>{
     "Bhanu":["hari@gmail.com","balu@gmail.com","santha@gmail.com"],
     "root":["bhanu@gmail.com","anu@gmail.com","apar@gmail.com"],
     "hari":["bhanuprasad@gmail.com","sravya@gmail.com","mahesh@gmail.com"],
     "balu":["rama@gmail.com"]
  }
  </code></pre>
  
  <p>Now I convert this object with <code>GSon</code>:</p>
  
  <pre><code>Gson gson = new GSon();
  String orgChartUsers = gson.toJson(map);
  </code></pre>
  
  <p>Now I passed this string to JavaScript because this is my Ajax response:</p>
  
  <pre><code>function orgUsers( result ) {
      var orgObject = JSON.parse( result );  
  
           for(var name in result) {
                  console.log(name + "=" + result[name]);
  
  
                 }
  }
  </code></pre>
  
  <p>This is working fine but i want to fetch data like this
    first i want to fetch data from <strong>"root"</strong>  in root i have some data when i read root for example i got <strong>bhanu@gmail.com</strong> now i want to fetch the data from <strong>Bhanu</strong> here i got some data like <strong>hari@gmail.com</strong> again i want to fetch data for <strong>hari</strong> like this i want how can i do this any one help me</p>