Tutorials References Exercises Menu
Paid Courses

Node.js buffer toJSON() Method

❮ Buffer Module


Example

Return the buffer object as a JSON object:

var buf = Buffer.from('abc');

console.log(buf.toJSON());
Run example »

Definition and Usage

The toJSON() method returns a JSON object based on the Buffer object.


Syntax

buffer.toJSON();

 Technical Details

Return Value: A JSON object
Node.js Version: 0.9.2

❮ Buffer Module