JSON binary encoding
Solution 1
If you want to store binary data inside the JSON object have a look at this question Binary Data in JSON String. Something better than Base64
If you want to transmit your JSON object in binary form you can simply serialize your JSON object into binary stream. Read MSDN article on (de)serialization
If you are looking for binary JSON format check http://bsonspec.org/
Solution 2
Further to what aku mentioned, Json.Net has support for Bson, have a look in the Newtonsoft.Json.Bson Namespace section of their documentation to find out more about the BsonReader and BsonWriter classes. They might give you what you need.
Tomas
Updated on June 25, 2022Comments
-
Tomas almost 2 years
I am building JSon object and I need to output binary data. As I understand I should create JSon string property and put encoded binary data in it? What binary encoding should be used?
-
Tomas over 12 yearsI will provide public service and if I will use 3rd party method to encode binaries then not all service users may have possibility to decode data.