ConvertersLesson 27Free preview
XML to JSON
This lesson is part of Web Developer Tools · All levels
Summary
The XML to JSON converter converts XML elements into JSON objects and arrays. Attributes are usually mapped with a special prefix such as @, whereas text within the element can be either a direct value or a property of #text. Repeating elements are generally grouped into arrays. Because XML supports mixed content and sequences, conversions can lose some information if they don't use the right convention.
Key points
- XML elements become key objects, while the contents become values
- Attributes are often mapped with the prefix @ or special property
- The repeating elements are usually arrays
- Mixed content and element order can be lost during conversion
- There is no one universal convention; check the converter settings
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.