nev*_*ame 9 javascript json bson
So BSON is JSON serialized right?
{"hello": "world"}
→ "\x16\x00\x00\x00\x02hello\x00 \x06\x00\x00\x00world\x00\x00"
But why is it called Binary Json? What does binary stands for?
I always tend to associate binary with 10101010101. But the BSON serialization format above wasn't in 101010101010 form.
Could someone explain for me what the Binary here means so I understand why it's called Binary JSON?
Jon*_*eet 20
它是二进制而不是文本.JSON是人类可读的文本,而BSON是二进制数据(只是字节).您可以将其写为1001010等,但一次显示每个字节更常见(因此\ x16只是十六进制16,即十进制字节22).这里基本上"二进制"用于将其与文本数据进行比较,而不是说它实际上是基数2.
这意味着您只能在可以传输任意二进制数据的情况下使用BSON.例如,如果您想在一个XML文档中嵌入BSON(无论出于何种原因!),您必须首先对它进行base64编码,因为XML是基于文本的表示.
归档时间: |
|
查看次数: |
1645 次 |
最近记录: |