Apart from above solution I might go for below approach.
1) Send the path as parameter to your request
2) In the servlet/service , iterate the children
3) I will have a POJO like below to populate the children
public class Document {
private String name;
private String title;
....
<getter and setter for both >
}
4) While iterating , add the name and title and form a list of this POJO .
5) Once the iteration is complete , convert the POJO to JSON using GSON API
If you need more details do let me know
Thanks
Veena