private static void render(JsonGenerator json, Node node) throws IOException {
        json.writeStartObject();
        if (node instanceof NamedNode) render(json, (NamedNode) node);
        if (node instanceof OutputNode) render(json, (OutputNode) node);

        if ( ! node.children().isEmpty()) {
            json.writeArrayFieldStart("children");
            for (Node child : node.children) {
                render(json, child);
            }
            json.writeEndArray();
        }
        json.writeEndObject();
    }
@author valerijf
@author jonmv
@author mortent
vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestRunnerHandler.java