springmvc json串的null值替换为空值

springmvc配置文件


	
		
			text/html;charset=UTF-8
			application/json;charset=UTF-8
		
	
      
          
              
                  
                      
                          
                      
                  
              
          
        

NullValueSerializer

public class NullValueSerializer extends JsonSerializer {  
    @Override  
    public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider)  
            throws IOException, JsonProcessingException {  
        jgen.writeString("");
    }  
}
 
    
   

  

  

转载于:https://www.cnblogs.com/BINGJJFLY/p/10812119.html

你可能感兴趣的:(springmvc json串的null值替换为空值)