title: JSONata - JSON to JSON Transformation in Nodejs API
body: <p>I need to write REST API in Node jS for JSON to JSON transfromation.</p>
  
  <p>There are many library and I sort listed <a href="https://www.npmjs.com/package/jsonata" rel="nofollow noreferrer">"JSONata"</a></p>
  
  <p>Please find JSONata simple sample <a href="http://try.jsonata.org/HJXxE9TEH" rel="nofollow noreferrer">here</a></p>
  
  <p>The challenge is API receive JSON which has data and map but JSONata require map value without quotes.</p>
  
  <p><code>{
      "data" : {
        "title" : "title1",
        "description": "description1",
        "blog": "This is a blog.",
        "date": "11/4/2013"
      },
      "map" : {
        "name": "title",
        "info": "description",
        "data" : {
           "text": "blog",
            "date": "date"
          }
      }
  }
  </code>
  but the map object expected by JSONata is like below.</p>
  
  <pre><code>{
    "name": title,
    "info": description,
    "some" : {
   "text": blog,
    "date": date
    }
  </code></pre>
  
  <p>}</p>
  
  <p>The above JSON key is in Quotes and value without Quotes.</p>
  
  <p>Please find the NodeJS API code.</p>
  
  <pre><code>app.post('/JSONTransform', function(req, res, next) 
  {
  const data = req.body.data;
  const map = req.body.map;
  var expression = jsonata(map);
  var result = expression.evaluate(data);
  res.send(result);
  });
  </code></pre>
  
  <p>I can write simple function to remove quotes but the above map is simple example. It can be any no of child object and may have some special character in the value including quotes.</p>
  
  <p>I prefer some npm library or standard way to remove quotes  or configure JSONata to accepts quotes in value.</p>
  
  <p>Appreciate if you suggest any other library or option.</p>
  
  <p>This Node JS API is called from ASP.NET Core Web API.
  ASP.NET Core Web API gets the data and map from database and pass this as single JSON to Node JS API.</p>
  
  <p>Please suggestion solution to this problem or best alternative.</p>
  
  <p>Thanks</p>
  
  <p>Raj</p>