public JsonObject toJson(String prefix) {
        if (this.children == null) {
            return new JsonObject();
        }

        JsonObject object = new JsonObject();
        for (Map.Entry<String, ImmutableTreeNode> entry : this.children.entrySet()) {
            String name = prefix + entry.getKey();
            object.add(name, entry.getValue().toJson(name + "."));
        }
        return object;
    }
Gets the node endings of each branch of the tree at this stage

The key represents the depth of the node.

@return the node endings
common/src/main/java/me/lucko/luckperms/common/treeview/ImmutableTreeNode.java