title: insert json into mysql table in node js
body: <p>I've table users with following field</p>
  
  <p>id,name(varchar) ,gallery(json)</p>
  
  <p><code>gallery</code> contains the the image path of user uploaded rows, a user can more images to his gallery and the image path of each image is stored in <code>gallery</code> as json</p>
  
  <p>here is a sample row</p>
  
  <pre><code>id name gallery
  
  1  blob ["test.jpg","test1.jpeg"]
  </code></pre>
  
  <p>Here is my code</p>
  
  <pre><code>function(req,res){
  //image path after upload
  var imagePath =uploadS3();
  
  //SELECT gallery FROM user   and store to oldGallery
   var oldGallery = getCurrentGallery()
   var updatedGallery;
  if(oldGallery==null){
      updatedGallery = "[\""+imagePath+"\"]"
  
  }else{
      //concatinate the gallery row with new imagepath
        updatedGallery = JSON.parse(oldGallery).push(imagePath);
   }
  
     db.query("UPDATE users SET gallery=? ",[updatedGallery],function(error,result){
  });
  }
  </code></pre>
  
  <p>But the problem with <code>JSON.parse(oldGallery).push(imagePath);</code> it didn't worked 
  console.log(<code>JSON.parse(oldGallery).push(imagePath)</code>) outputs <code>2</code> instead of the array. </p>