Following is the syntax of the method to convert a Node Buffer into JSON object:
buf.toJSON()
This method returns a JSON-representation of the Buffer instance.
// example//from ww w. ja v a2s . c o m var buf = Buffer.from('Simply Easy Learning'); var json = buf.toJSON(buf); console.log(json);