I think there could be a potential fast path by having `asJSON` write into a buffer and send that to `stream.write`.