json.object().key("description").value(model.getDescription());
json.key("children").array();
for (String child : model.getChildren())
{
json.object().key("name").value(child);
NamedDescription nd = model.getChildDescription(child);
if (nd != null)
{
json.key("description").value(nd.getDescription());
}
json.endObject();
}
json.endArray().key("operations").array();
for (NamedDescription nd : model.getOperations())
{
json.object().key("operation-name").value(nd.getName()).key("operation-description").value(nd.getDescription()).endObject();
}
json.endArray().endObject();
printWriter.write(new JSONObject(json.toString()).toString(3));
printWriter.flush();