private void createJsonTree(Iterator<ServiceMenu> iterator, StringBuffer buffer) {
while (iterator.hasNext()) {
ServiceMenu c = iterator.next();
buffer.append("{id:" + c.getOid() + ",text:'" + c.getName() + "',");
if (c.getSet().size() > 0) {
buffer.append("state:'open'");
buffer.append(",'children':[");
this.createJsonTree(c.getSet().iterator(), buffer);
String str = buffer.toString().substring(0, buffer.toString().length() - 1);
buffer.delete(0, buffer.toString().length());
buffer.append(str + "]},");
} else {
buffer.append("state:'open'");
buffer.append("},");
}
}
}