---
title: "spring mvc去除返回json时为NULL的字段"
author: "hepx"
date: "2012-09-13T11:55:47Z"
tags: []
categories: ["开源软件"]
slug: "spring-mvc-json-null"
draft: false
lastmod: "2012-09-13T11:55:47Z"
id: 1677652
url: "https://hepx.iteye.com/blog/1677652"
---

1：条件

spring MVC 3.X

//支持注解版本

jackson-code.jar 

jackson-mapper.jar

2:使用：

在需要序列化为json输出的object类上增加：@JsonSerialize(include=JsonSerialize.Inclusion.NON\_NULL)