3

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?

1

3 Answers 3

6

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/

Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

I 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.
0

There is also native binary json. The format is very simple and well defined, however there is lack of open-source implementation at the moment...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.