static HttpResponse ofJson(ResponseHeaders headers, Object content) {
        requireNonNull(headers, "headers");
        requireNonNull(content, "content");

        final HttpData httpData;
        try {
            httpData = HttpData.wrap(JacksonUtil.writeValueAsBytes(content));
        } catch (JsonProcessingException e) {
            throw new IllegalArgumentException(e.toString(), e);
        }

        final MediaType contentType = headers.contentType();
        if (contentType != null && contentType.isJson()) {
            return of(headers, httpData);
        } else {
            final ResponseHeaders newHeaders = headers.toBuilder()
                                                      .contentType(MediaType.JSON)
                                                      .build();
            return of(newHeaders, httpData);
        }
    }
Creates a new HTTP response with the specified {@link ResponseHeaders} and {@code content} that is
converted into JSON using the default {@link ObjectMapper}.

@throws IllegalArgumentException if failed to encode the {@code content} into JSON.
@see JacksonObjectMapperProvider
core/src/main/java/com/linecorp/armeria/common/HttpResponse.java