YAML和JSON之间有什么不同,特别是考虑到以下几点?
- Performance (encode/decode time)
- 内存消耗
- 表达清晰度
- Library availability, ease of use (I prefer C)
I was planning to use one of these two in our embedded system to store configure files.
YAML和JSON之间有什么不同,特别是考虑到以下几点?
I was planning to use one of these two in our embedded system to store configure files.
Technically YAML is a superset of JSON. This means that, in theory at least, a YAML parser can understand JSON, but not necessarily the other way around.
See the official specs, in the section entitled "YAML: Relation to JSON".
总的来说,我喜欢YAML中的某些东西,但在JSON中是不可用的.
In practice neither of these last two points will likely matter for things that you or I do, but in the long term, I think YAML will be a more robust and viable data serialization format.
Right now, AJAX and other web technologies tend to use JSON. YAML is currently being used more for offline data processes. For example, it is included by default in the C-based OpenCV computer vision package, whereas JSON is not.
您将找到用于JSON和YAML的C库.YAML的库往往比较新,但我过go 没有遇到过任何问题.请参见示例Yaml-cpp.