After parsing Springboot with Fastjson, how can it be applied only to requestBody, returned objects or using the original?

how to use Fastjson, to only process the request message and not to process the return message, or to use the original processing method of SpringBoot?

the code to add the Fastjson converter is as follows:

    @Bean
    public HttpMessageConverters fastJsonHttpMessageConverters() {
        // FastJson
        FastJsonConfig fastJsonConfig = new FastJsonConfig();
        fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteNullStringAsEmpty);
        
        // converter
        FastJsonHttpMessageConverter4 fastJsonConverter = new FastJsonHttpMessageConverter4();
        fastJsonConverter.setFastJsonConfig(fastJsonConfig);
        
        return new HttpMessageConverters(fastJsonConverter);
    }

the above code takes effect on both the request and the return. How to make it take effect only when the request is made, and the return is not processed?

Thank you all!


No, you can only switch back to Jackson

Menu