code: public static JsonObject rename(final JsonObject outdatedDBEntry, final String newName, final String... path) {
          // store root element
          JsonObject parent = outdatedDBEntry;
  
          // lookup element to rename
          for (int i = 0; i < path.length; i++) {
              final String propertyName = path[i];
  
  
              // property not found so nothing to rename
              if (!parent.has(propertyName)) {
                  return outdatedDBEntry;
              }
  
              // if element to rename selected than rename otherwise contine with next element
              if (i == path.length - 1) {
                  parent.add(newName, parent.remove(propertyName));
  
              } else {
                  // prepare next round
                  parent = parent.getAsJsonObject(propertyName);
              }
          }
          return outdatedDBEntry;
      }
docs: Method to rename a field.
  
  @param outdatedDBEntry the root entry of the path.
  @param newName         the new name of the field.
  @param path            the path inclusive the old field.
  
  @return the updated value.