title: Parsing JSON result from Nodejs mssql result
body: <p>I have a NodeJS app calling a MSSqlserver stored procs and returns a JSON result.</p>
  
  <p>How do I parse the JSON result to get only this value</p>
  
  <pre><code>[{"DataMartCode":"NPL","DataMartDescription":null},{"DataMartCode":"FP","DataMartDescription":"Only for Banks that report Funding Plans"}]
  </code></pre>
  
  <p><strong>JSON result</strong></p>
  
  <pre><code>{
      recordsets:[
          [
              {
                  JSON_F52E2B61-18A1-11d1 - B105-00805F49916B:"[{"DataMartCode":"NPL","DataMartDescription":null},{"DataMartCode":"FP","DataMartDescription":"Only for Banks that report Funding Plans"}]"
              }
          ]
      ], 
      recordset:[ 
          {
              JSON_F52E2B61-18A1-11d1 - B105-00805F49916B:"[{"DataMartCode":"NPL","DataMartDescription":null},{"DataMartCode":"FP","DataMartDescription":"Only for Banks that report Funding Plans"}]"
          }
      ], 
      output: {}, 
      rowsAffected:[11], 
      returnValue:0
  }
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>var express = require('express'); 
  var router = express.Router(); 
  var sql = require('mssql'); 
  
  /* GET home page. */
  router.get('/', function(req, res, next) {
      res.render('index',  {title:'Express'}); 
  }); 
  
  
  // SQL Server config
  var config =  {
      user:'user', 
      password:'pass', 
      server:'localhost', 
      database:'mydb'
  }; 
  
  
  router.get('/datamart', function (req, res) {
  
      // connect to your database
      sql.connect(config, function (err) {
          if (err)console.log(err); 
  
          // create Request object
          var request = new sql.Request(); 
  
          // query to the database and get the data
          request.execute('dbo.get_datamart', function (err, result) {
              if (err)console.log(err)
  
              // send data as a response
              console.log(result.recordset);
              res.send(result); 
  
              sql.close();
          }); 
  
      }); 
  
  }); 
  
  module.exports = router; 
  </code></pre>