title: I do I parse the string from req.query?
body: <p>I am supposed to retrieve the string from my req.query in express. I am implementing a RESTFul API and my code looks like</p>
  
  <pre><code>router.get('/', function(req, res) {
  
      var count = req.query.count;
      var sorting = req.query.sort;
      //let obj = JSON.parse(sorting)
  
  
      if(count == "true") {
          user.find({}, function(err, users) {
              if(err){
                  res.status(404).send({
                      message: err,
                      data: []
                  });
              } else {
                  res.status(200).send({
                      message: 'OK ttt',
                      data: users.length
                  });
              }
      });
      } 
  </code></pre>
  
  <p>Let's say my </p>
  
  <pre><code>var sorting = req.query.sort
  </code></pre>
  
  <p>Give me {\"name\": 1}"</p>
  
  <p>I want to parse out the "name" from this.</p>
  
  <p>I used </p>
  
  <pre><code>JSON.parse(sorting)
  </code></pre>
  
  <p>But it returned an object, not a string.</p>