private static void writeError(WebSocketWriter out, String operationId, Throwable t) {
        final Map<String, Object> errorResponse = ImmutableMap.of(
                "type", "error",
                "id", operationId,
                "payload", ImmutableList.of(
                        new GraphQLError() {
                            @Nullable
                            @Override
                            public String getMessage() {
                                return t.getMessage();
                            }

                            @Override
                            public List<SourceLocation> getLocations() {
                                return emptyList();
                            }

                            @Override
                            public ErrorClassification getErrorType() {
                                return ErrorType.DataFetchingException;
                            }
                        }.toSpecification()
                ));
        try {
            final String event = serializeToJson(errorResponse);
            logger.trace("ERROR: {}", event);
            out.tryWrite(event);
        } catch (JsonProcessingException e) {
            logger.warn("Error serializing error event", e);
            out.close(e);
        }
    }
This only works reliably if maybeMap is from Json, as maps(objects) in Json
can only have string keys.
graphql/src/main/java/com/linecorp/armeria/server/graphql/GraphqlWSSubProtocol.java