title: how do I assign values to a variable taking them from JSON using a nested for loop?
body: <p>I have a JSON with both subject fields and their corresponding values separately. I want to write a nested for loop that will assign the value to each subject field from below json. Right now, I am using a single for loop to loop through all the values by defining the subject field. I will be using sqlcmd-insert in each for loop after I assign the values to subjects.</p>
  <pre><code>for(var i = 0; i &lt; obj.value.length; i++){
  const Name= mm[i][0];
  const Age= mm[i][1];
  const Country= mm[i][2];
  const Gender= mm[i][3];
  const IsActive= mm[i][3];
  }
  </code></pre>
  <p>I don't want to define variable names, instead I want it to be taken directly from JSON subject field and assign the corresponding value. I tried below nested loop but it doesn't work. How can I make this work? Please help.</p>
  <pre><code>for(var i = 0; i &lt; obj.value.length; i++)
        {
          for(var j = 0; j &lt; obj.subject.length; j++)
          {
            const obj.subject[i].field = obj.value[i][j];
          }
        }
  </code></pre>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>{
    "First": 1,
    "Last": 3,
    "msg": "",
    "subject": [
      {
        "col": 0,
        "field": "Name"
      },
      {
        "col": 1,
        "field": "Age"
      },
      {
        "col": 2,
        "field": "Country"
      },
      {
        "col": 3,
        "field": "Gender"
      },
      {
        "col": 4,
        "field": "IsActive"
      }
    ],
    "value": [
      [
        "Sam",
        30,
        "US",
        "Male",
        "Y"
      ],
      [
        "Tom",
        32,
        "UK",
        "Male",
        "Y"
      ],
      [
        "Kate",
        28,
        "USA",
        "Female",
        "N"
      ]
    ]
  }</code></pre>
  </div>
  </div>
  </p>