JSON serialize with different field names on Spring MVC
<p>I've been working on a a controller in which I want to return json string as a response. But the problem is that, I want to change some field names during serialize/deserialize, but I don't want to use ugly annotations on my entity objects.</p>

<p>Lets say</p>

<pre><code>@Controller
@RequestMapping("/kfc/brands")
public class JSONController {

    @RequestMapping(value="{name}", method = RequestMethod.GET)
    public @ResponseBody Shop getShopInJSON(@PathVariable String name) {

        Shop shop = new Shop();
        shop.setName(name);
        shop.setStaffNames(new String[]{"mkyong1", "mkyong2"});

        return shop;

    }

}

public class Shop {
        String name;
        String staffNames[];
        String location;

        //getter and setter methods

    }
</code></pre>

<p>I want the controller to return <code>staffNames as staff_names</code> , <code>location as address</code> without using any annotations.</p>

<p>I assume there has to be a custom object mapper structure to to that but couldn't find a proper example. I have no problems with setting field names manually in the serialization code.</p>

<p>PS: example taken from <a href="http://www.mkyong.com/spring-mvc/spring-3-mvc-and-json-example/" rel="nofollow">mkyong</a></p>