title: how to select an element from json array and display on html using nodejs
body: <p>I have a table in DynamoDB local named userGroup. The items are as follows</p>
  
  <pre><code>{
      "Items": [{
          "id": "A004",
          "name": "ACC LR2",
          "userId": ["1", "2", "3", "4"],
          {
              "id": "0001",
              "name": "ABG IT",
              "userId": ["8", "9", "10", "11"]
          }
      }]
  }
  </code></pre>
  
  <p>There are more than 20 lines like this.<br>
  This is an entire row</p>
  
  <pre><code>    {
          "id": "A004",
          "name": "ACC LR2",
          "userId": ["1", "2", "3", "4"]
  }
  </code></pre>
  
  <p>this is my routes users.js</p>
  
  <pre class="lang-js prettyprint-override"><code>router.get('/groups', function (req, res, next) {
      var params = {
          TableName: 'userGroup',
      };
      dynamodb.scan(params, function (err, data) {
          if (err) {
              console.log(err);
          } else {
              console.log("List of Groups: " + console.log(JSON.stringify(data.Items)));
              res.render('groups', {
                  _uG: data.Items
              });
          }
      });
  });
  </code></pre>
  
  <p>my group.html is like this</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;table&gt;
  &lt;thead&gt;
  &lt;tr role="row"&gt;
  &lt;th&gt;Id&lt;/th&gt;
  &lt;th&gt;User ID&lt;/th&gt;
  &lt;th&gt;Name&lt;/th&gt;
  &lt;th&gt;Details&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  
  &lt;tbody&gt;     
  &lt;% for(var i = 0; i &lt; _uG.length; i++) { %&gt;                           
  &lt;tr&gt;
  &lt;td &gt;&lt;%= _uG[i].id.S %&gt;&lt;/td&gt;            
  &lt;td&gt;&lt;%= _uG[i].name.S %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;a href="/users/groups/group-info?&lt;%= _uG[i].id.S %&gt;"&gt;Details&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;% } %&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>this displays values of ID and name and details in a list format in every <code>&lt;td&gt;</code> on the group.html page. NOW when i click on details i should go to group-info page which would display only the all details of only userId from dynamoDB only for that particular row which is selected. </p>
  
  <p>my second routes in users.js</p>
  
  <pre class="lang-js prettyprint-override"><code>    router.get('/groups/group-info', function (req, res, next) {
          console.log("id " + req.query.id);
          var params = {
              TableName: 'userGroup',
          };
          console.log("PARAMS: " + JSON.stringify(params));
          dynamodb.scan(params, function (err, data) {
              if (err) {
                  console.log(err);
              } else {
                  // console.log("These are Groups: "+ console.log(JSON.stringify(data.Items)));
                  console.log("User DETAILS: " + console.log(JSON.stringify(data.Items)));
                  res.render('group-info', {
                      _userD: data.Items
                  });
              }
          });
      });
  </code></pre>
  
  <p>HTML page table 2 for displaying details of data pertaining to  is like </p>
  
  <pre><code>&lt;table&gt;
  &lt;thead&gt;
  &lt;tr role="row"&gt;
  &lt;th&gt;Id&lt;/th&gt;
  &lt;th&gt;User ID&lt;/th&gt;
  &lt;th&gt;Name&lt;/th&gt;
  &lt;th&gt;Details&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  
  &lt;tbody&gt;     
  &lt;% for(var i = 0; i &lt; _uG.length; i++) { %&gt;                           
  &lt;tr&gt;
  &lt;td &gt;&lt;%= _uG[i].id.S %&gt;&lt;/td&gt;            
  &lt;td&gt;&lt;%= _uG[i].name.S %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;a href="/users/groups/group-info?&lt;%= _uG[i].id.S %&gt;"&gt;Details&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;% } %&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>So what do I do in group-info.js page to display userId of selected <code>&lt;td&gt;</code> of particular row.?? </p>
  
  <p>Help is appreciated .. </p>