code: public Object truncate() {
          Object value = navigatePath();
          if (maxDepth == 0) {
              return value;
          }
          if (! (value instanceof JSONObject)) {
              return value;
          } else {
              // Truncate all levels below
              return truncateJSONObject((JSONObject) value, maxDepth);
          }
      }
docs: Extract either a sub tree or a leaf value. If a path is used, then adding MBeanInfos has added them
  as if no path were given (i.e. in it original place in the tree) but leaves out other information
  not included by the path. This method then moves up the part pointed to by the path to the top of the
  tree hierarchy. It also takes into account the maximum depth of the tree and truncates below
  
  @return either a Map for a subtree or the leaf value as an object