200-901 · Question #295
What is a comparison of YAML and JSON?
The correct answer is B. JSON does not support comments and YAML does. The key factual difference highlighted in Answer B is correct: JSON does not support comments in its specification, while YAML does support comments using the '#' character. This makes YAML more suitable for configuration files where inline documentation is valuable. Answer A…
Question
What is a comparison of YAML and JSON?
Options
- AYAML has a more consistent approach to representing data compared to JSON.
- BJSON does not support comments and YAML does.
- CYAML is a more verbose data structure compared to JSON.
- DJSON has more common usage in configuration management tools compared to YAML.
How the community answered
(20 responses)- A5% (1)
- B95% (19)
Explanation
The key factual difference highlighted in Answer B is correct: JSON does not support comments in its specification, while YAML does support comments using the '#' character. This makes YAML more suitable for configuration files where inline documentation is valuable. Answer A is incorrect - YAML's multiple ways to represent the same data (block style, flow style, anchors, aliases) make it less consistent, not more, compared to JSON's strict syntax. Answer C is incorrect - YAML is generally less verbose than JSON because it does not require quotes around strings or curly braces/brackets for structure. Answer D is incorrect - YAML is actually more commonly used in configuration management tools (Ansible playbooks, Kubernetes manifests, Docker Compose), while JSON is more prevalent in REST APIs.
Topics
Community Discussion
No community discussion yet for this question.