views:

14

answers:

0

I want to convert a XML File to JSON. The problem is, I have the structure

Content ...

Secon ...

Secon ...

Secon ...

I want it to the JSON Format like:

{ "nodeid" : "34", "text" : "First level", "children" : [{ "nodeid" : "1", "text" : "Content ...", "leaf" : true ,"children" : [{ "nodeid" : "2", "text" : "Second", "leaf" : true ,"children" : [{ "nodeid" : "3", "text" : "Third", "leaf" : true },]

But there is always a comma "," after the laste children. With freemarker there is a way to find out if the node have a parent, children or whatever, like node?parent, node?children. But no chance to find out, if there it has a sibling.

How does freemarker know, if the current node has a sibling?