title: Parsing a JSON Map to object
body: <p>I'm converting my response that is in JSON to a readable form. The response is a Map.i.e it has a key and value.</p>
  
  <pre><code> data={
    "name":"name1"
    "mapIWantToConvert":{
                         "key1":"value1"
                         "key2":"value2"
                         "key3":"value3"
                        }
        }
  </code></pre>
  
  <p>I want to iterate and get all the values of key and value and set them to other var.I am getting keys from a for loop.
  this is not working:</p>
  
  <pre><code>var convertedData=data.mapIWantToConvert.key[i];
  </code></pre>
  
  <p>what am i doing wrong. thank you</p>
  
  <p>output is a again a json file but a different one .</p>
  
  <pre><code>output={
      "allDataForkey1":{
                         "key1":"value1"
                        }
      "allDataForKey2":{
                        "key2":"value2"
                        }
   }
  </code></pre>