docs: public JsonWriter endObject() {
          if (!context.map()) {
              throw new IllegalStateException("Unexpected end, not in object.");
          }
          if (context.value()) {
              throw new IllegalStateException("Expected map value but got end.");
          }
          writer.write('}');
          context = stack.pop();
          return this;
      }