title: javascript How to create one JSON by combining two JSONs
body: <p>I am facing an issue in small requirement. I want to create a JSON array in below format using JavaScript for loops.</p>
  
  <pre><code>var mainJson = {
          "people": [{
                  "name": "Ravi",
                  "role": "team member",
                  "appointments": [{
                          "info": "room 1",
                          "type": "Type01"
                          "title": "Meet John Miller"
                      }, {
                          "info": "room 2",
                          "type": "Type02"
                          "title": "Meet Mitchell"
                      }]
              ]
          }
      };
  </code></pre>
  
  <p>To create above JSON, I have 2 jsons like below..</p>
  
  <pre><code>var subJson1 = [{
              "RowId": "00272727",
              "Rowlabel": "Ravi",
              "role": "team member"  
  }]
  
  var subJson2 = [{
        "info": "room 1",
        "RowId": "00272727",
        "type": "Type01",
        "title": "Meet John Miller"
        }, {
        "info": "room 2",
        "type": "Type02",
        "RowId": "00272727",
        "title": "Meet Mitchell"
        }]
  </code></pre>
  
  <p>Here in both <strong>SubJson1</strong> and <strong>subJson2</strong> "<strong>RowID</strong>" is the common parameter. Based on <strong>RowId</strong> we have to create <strong>mainJson</strong> .In the <strong>mainJson</strong> in <strong>people</strong> array objects will be more than 1. im just displaying only one item for understanding.</p>
  
  <p>Im trying to achieve this with for loops. But im facing issues to resolve this. Can some one help me to create the <strong>mainJson</strong> using <strong>subJson1</strong> and <strong>subJson2</strong></p>
  
  <p>Thank you in advance.</p>