private void toGroupingRequest(Inspector groupingJson, StringBuilder b) {
        switch (groupingJson.type()) {
            case ARRAY:
                groupingJson.traverse((ArrayTraverser) (index, item) -> {
                    toGroupingRequest(item, b);
                    if (index + 1 < groupingJson.entries())
                        b.append(",");
                });
                break;
            case OBJECT:
                groupingJson.traverse((ObjectTraverser) (name, object) -> {
                    b.append(name);
                    b.append("(");
                    toGroupingRequest(object, b);
                    b.append(") ");
                });
                break;
            case STRING:
                b.append(groupingJson.asString());
                break;
            default:
                b.append(groupingJson.toString());
                break;
        }
    }
Translates a list of grouping requests on JSON form to a list in the grouping language form
container-search/src/main/java/com/yahoo/search/query/SelectParser.java