title: How to exclude certain modelAttributes in JSON output (using ContentNegotiatingViewResolver)
body: <p>I have a Spring MVC 3.1.0 project and I have configured a <code>ContentNegotiatingViewResolver</code> bean to automatically generate JSON output for a given endpoint (which uses <code>org.springframework.web.servlet.view.json.MappingJacksonJsonView</code>). </p>
  
  <p>I have a few controller methods which add data to the JSP page (via <code>model.addAttribute("foo", fooService.getFoo());</code>) that I don't want to appear in the JSON output.</p>
  
  <p>I have tried adding a <code>@JsonIgnore</code> annotation to my service method <code>getFoo()</code> (which returns a <code>Map&lt;String, String&gt;</code>) but it doesn't work. I still see the foo object being marshalled in my JSON output when I hit that controller.</p>
  
  <p>Can anyone suggest another way of achieving this or tell me why the <code>JsonIgnore</code> annotation is not working?</p>