{"action":"created","issue":{"url":"https://api.github.com/repos/alibaba/fastjson/issues/946","repository_url":"https://api.github.com/repos/alibaba/fastjson","labels_url":"https://api.github.com/repos/alibaba/fastjson/issues/946/labels{/name}","comments_url":"https://api.github.com/repos/alibaba/fastjson/issues/946/comments","events_url":"https://api.github.com/repos/alibaba/fastjson/issues/946/events","html_url":"https://github.com/alibaba/fastjson/issues/946","id":194537744,"number":946,"title":"Fastjson与Spring MVC 整合后配置WriteMapNullValue怎么让一部分类序列化后不输出null","user":{"login":"Bobi-zhou","id":12620198,"avatar_url":"https://avatars.githubusercontent.com/u/12620198?v=3","gravatar_id":"","url":"https://api.github.com/users/Bobi-zhou","html_url":"https://github.com/Bobi-zhou","followers_url":"https://api.github.com/users/Bobi-zhou/followers","following_url":"https://api.github.com/users/Bobi-zhou/following{/other_user}","gists_url":"https://api.github.com/users/Bobi-zhou/gists{/gist_id}","starred_url":"https://api.github.com/users/Bobi-zhou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bobi-zhou/subscriptions","organizations_url":"https://api.github.com/users/Bobi-zhou/orgs","repos_url":"https://api.github.com/users/Bobi-zhou/repos","events_url":"https://api.github.com/users/Bobi-zhou/events{/privacy}","received_events_url":"https://api.github.com/users/Bobi-zhou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-09T08:19:28Z","updated_at":"2016-12-10T06:32:02Z","closed_at":null,"body":"在Spring mvc中配置为\r\n<!--fastjson config-->\r\n    <bean id=\"fastJsonConfig\" class=\"com.alibaba.fastjson.support.config.FastJsonConfig\">\r\n        <!-- Default charset -->\r\n        <property name=\"charset\" value=\"UTF-8\" />\r\n        <!-- SerializerFeature -->\r\n        <property name=\"serializerFeatures\">\r\n            <list>\r\n                <value>QuoteFieldNames</value>\r\n                <value>WriteMapNullValue</value>\r\n            </list>\r\n        </property>\r\n    </bean>\r\n    <mvc:annotation-driven>\r\n        <mvc:message-converters register-defaults=\"true\">\r\n             <!--将StringHttpMessageConverter的默认编码设为UTF-8-->\r\n            <bean class=\"org.springframework.http.converter.StringHttpMessageConverter\">\r\n                <constructor-arg value=\"UTF-8\"/>\r\n            </bean>\r\n            <!-- 配置Fastjson支持 -->\r\n            <bean class=\"com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter\">\r\n                <property name=\"supportedMediaTypes\">\r\n                    <list>\r\n                        <value>application/json</value>\r\n                    </list>\r\n                </property>\r\n                <property name=\"fastJsonConfig\" ref=\"fastJsonConfig\"/>\r\n            </bean>\r\n        </mvc:message-converters>\r\n    </mvc:annotation-driven>\r\n\r\n这样配置后，Controller返回的对象属性值为空会输出{\"name\":null} ，怎么让一部分类序列化输出忽略null\r\n\r\n使用jackson时默认输出null，但是在类上加上注解@JsonInclude(JsonInclude.Include.NON_NULL)就可以实现目的，但是在fastjson中没有找到相关配置。"},"comment":{"url":"https://api.github.com/repos/alibaba/fastjson/issues/comments/266182895","html_url":"https://github.com/alibaba/fastjson/issues/946#issuecomment-266182895","issue_url":"https://api.github.com/repos/alibaba/fastjson/issues/946","id":266182895,"user":{"login":"CharkeyQK","id":5127583,"avatar_url":"https://avatars.githubusercontent.com/u/5127583?v=3","gravatar_id":"","url":"https://api.github.com/users/CharkeyQK","html_url":"https://github.com/CharkeyQK","followers_url":"https://api.github.com/users/CharkeyQK/followers","following_url":"https://api.github.com/users/CharkeyQK/following{/other_user}","gists_url":"https://api.github.com/users/CharkeyQK/gists{/gist_id}","starred_url":"https://api.github.com/users/CharkeyQK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CharkeyQK/subscriptions","organizations_url":"https://api.github.com/users/CharkeyQK/orgs","repos_url":"https://api.github.com/users/CharkeyQK/repos","events_url":"https://api.github.com/users/CharkeyQK/events{/privacy}","received_events_url":"https://api.github.com/users/CharkeyQK/received_events","type":"User","site_admin":false},"created_at":"2016-12-10T06:32:02Z","updated_at":"2016-12-10T06:32:02Z","body":"[4. 使用serialize/deserialize指定字段不序列化](https://github.com/alibaba/fastjson/wiki/JSONField#4-%E4%BD%BF%E7%94%A8serializedeserialize%E6%8C%87%E5%AE%9A%E5%AD%97%E6%AE%B5%E4%B8%8D%E5%BA%8F%E5%88%97%E5%8C%96)"}}
{"actor":{"display_login":"CharkeyQK"}}