200-901 · Question #520
How do JSON and XML compare?
The correct answer is C. The syntax of XML contains tags, elements, and attributes whereas JSON objects are collections. XML (eXtensible Markup Language) uses a tag-based syntax where data is wrapped in opening and closing tags (e.g., <name>value</name>), organized into elements, and can include attributes within tags (e.g., <user id='1'>). JSON (JavaScript Object Notation) represents data as colle
Question
How do JSON and XML compare?
Options
- AThe syntax of JSON contains tags, elements, and attributes whereas XML objects are collections
- BJSON objects are an ordered set of element attributes whereas XML arrays are an unordered set
- CThe syntax of XML contains tags, elements, and attributes whereas JSON objects are collections
- DJSON arrays are an unordered set of key-value pairs whereas XML objects are an ordered set of
How the community answered
(66 responses)- A2% (1)
- B6% (4)
- C88% (58)
- D5% (3)
Explanation
XML (eXtensible Markup Language) uses a tag-based syntax where data is wrapped in opening and closing tags (e.g., <name>value</name>), organized into elements, and can include attributes within tags (e.g., <user id='1'>). JSON (JavaScript Object Notation) represents data as collections: objects are unordered sets of key-value pairs enclosed in curly braces {}, and arrays are ordered lists enclosed in square brackets []. Choice A incorrectly reverses the descriptions, attributing tags/elements/attributes to JSON. Choice B incorrectly states JSON objects are ordered (they are unordered) and confuses XML arrays (XML has no native array type). Choice D incorrectly describes JSON arrays as unordered key-value pairs (arrays are ordered lists, not key-value pairs).
Topics
Community Discussion
No community discussion yet for this question.