How to convert a Buffer data to JSON in Node.js?
Originally posted here!
To convert a Buffer to JSON, you can use the toJSON() method in the Buffer instance.
// convert buff object to json
const json = buff.toJSON();
For an example, let's say we have an array with some data like this,
// data
con...
melvingeorge-me.hashnode.dev2 min read