code: private JSONWriter end(char m, char c) throws JSONException {
          if (this.mode != m) {
              throw new JSONException(m == 'a'
                  ? "Misplaced endArray."
                  : "Misplaced endObject.");
          }
          this.pop(m);
          try {
              this.writer.append(c);
          } catch (IOException e) {
          	// Android as of API 25 does not support this exception constructor
          	// however we won't worry about it. If an exception is happening here
          	// it will just throw a "Method not found" exception instead.
              throw new JSONException(e);
          }
          this.comma = true;
          return this;
      }
docs: End something.
  @param m Mode
  @param c Closing character
  @return this
  @throws JSONException If unbalanced.