code: public JsonObject accumulate(String name, Object value) throws JsonException {
          checkIfFrozen();
          Object current = nameValuePairs.get(checkName(name));
          if (current == null) {
              return put(name, value);
          }
  
          if (current instanceof JsonArray) {
              JsonArray array = (JsonArray) current;
              array.put(value);
          } else {
              JsonArray array = new JsonArray();
              array.put(current);
              array.put(value);
              nameValuePairs.put(name, array);
          }
          return this;
      }
docs: unhidden.