> About the first, it related about a XML document like this:
>
> <book>
> <chapter>Content of the first chapter</chapter>
> <chapter>Content of the first [sic] chapter
> <chapter>Content of the first subchapter</chapter>
> <chapter>Content of the second subchapter</chapter>
> </chapter>
> <chapter>Third Chapter</chapter>
> </book>
There are many ways that you could render that into JSON. This is how
org.json.XML does it in Java:
{"book": {"chapter": [
"Content of the first chapter",
{
"content": "Content of the first [sic] chapter",
"chapter": [
"Content of the first subchapter",
"Content of the second subchapter"
]
},
"Third Chapter"
]}}