[buffer] Refactor byteLength() method
[buffer] Implement toJSON() method