Start a new topic

JSON to String and request.body to String ?

- How can I convert JSON to String and request.body to String into the backend ?

Hi Yordan,



Kinvey's BL code is a sandboxed NodeJS environment, which supports ECMAScript Edition 5. Therefore you have access to the standard built in object called JSON, [mozilla docs contain api details](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify "Mozilla Docs").



The following code worked for me:



function onRequest(request, response, modules){

var logger = modules.logger;



var str = JSON.stringify(request.body);

logger.info(str);



response.complete(200);

}



HTH
Thank You very very much Morgan. :)
Login or Signup to post a comment