title: Node.js - Parse simple JSON object and access keys and values
body: <p>I am new to Node and struggling to access a simple JSON object. My request.body will have JSON content similar to the following:</p>
  
  <pre><code>{
      "store_config": [
          {
              "name": "hello",
              "name2": "world"
          }
      ]
  }
  </code></pre>
  
  <p>The "store_config" value will always be present, however the keys and values within could be anything.</p>
  
  <p>How can I iterate through the keys and values to access each? I would also like to process each in an asynchronous manner.</p>
  
  <p>Appreciate any thoughts or direction.</p>
  
  <hr>
  
  <p>UPDATE</p>
  
  <pre><code>console.log(typeof(request.body));
  </code></pre>
  
  <p>Returns: <code>Object</code></p>
  
  <pre><code>parsedBody = JSON.parse(request.body);
  </code></pre>
  
  <p>returns: </p>
  
  <pre><code>SyntaxError: Unexpected token o
      at Object.parse (native)
  </code></pre>
  
  <hr>
  
  <p>UPDATE 2 - Further debug:</p>
  
  <p>When I try to iterate through the array, there is only a single value:</p>
  
  <pre><code>request.body.store_config.forEach(function(item, index) {
    console.log(index);
    console.log(request.body.store_config[index]);
  
  });
  </code></pre>
  
  <p>returns:</p>
  
  <pre><code>0
  { name: 'hello', name2: 'world' }
  </code></pre>