Is there any way to have Json.net serialize an object directly to a NetworkStream?
In other words, have Json.net send the serialized result to the network as it serializes the object (in a streaming fashion).
I would like to avoid having to serialize the object to memory and then send it via the NetworkStream.
Any thoughts?
Regards
You can create a
TextWriteron top of aNetworkStream, and serialize to theTextWriter; or you can create aJsonTextWriteron top of aTextWriterand serialize to that.You don’t need to serialize to, say, a temporary string or byte array first.