It looks like JSON does not parse into an actual type. Is this normal and expected behaviour for JSON.parse?
let parseBuf = JSON.parse('{"type":"Buffer","data":[146,247,204,173,154,172,70,6,147,130,219,222,4,69,161,74]}');
let bufferBuf = Buffer.from(parseBuf.data);
console.log(parseBuf instanceof Buffer)
console.log(bufferBuf instanceof Buffer)
console.log(JSON.stringify(parseBuf))
console.log(JSON.stringify(bufferBuf))
Results from the console log is
false
true
{"type":"Buffer","data":[146,247,204,173,154,172,70,6,147,130,219,222,4,69,161,74]}
{"type":"Buffer","data":[146,247,204,173,154,172,70,6,147,130,219,222,4,69,161,74]}
JSON.parsereturns a JS value or object. A Buffer is not a JS value or object, it's a Node-specific object.{"type": "Buffer", "data":[...]}into aBufferwithBuffer.fromas you did in the second line of your example. JSON knows very few types: string, number, array, object, boolean, null. Notoriously unsupported are: Buffer, Date, function, and undefined. Consider reading Convert a JSON Object to Buffer and Buffer to JSON Object backJSON.stringify(buffer)creates"type": "Buffer"in the output.