static final int writeJSONStringWithFastJsonConfig(
            OutputStream os,
            Charset charset,
            Object object,
            SerializeConfig config,
            SerializeFilter[] filters,
            String dateFormat,
            int defaultFeatures,
            SerializerFeature... features) throws IOException {
        for (SerializerFeature feature : features) {
            defaultFeatures |= feature.mask;
        }

        JSONWriter.Context context = JSON.createWriteContext(config, defaultFeatures, features);
        context.setDateFormat(dateFormat);
        try (JSONWriter writer = JSONWriter.ofUTF8(context)) {
            if (filters != null) {
                for (SerializeFilter filter : filters) {
                    JSON.configFilter(context, filter);
                }
            }

            writer.writeAny(object);

            return writer.flushTo(os, charset);
        }
    }
Method that JAX-RS container calls to serialize given value.
fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/jaxrs/FastJsonProvider.java