title: Own specific name for attributes from JSON response
body: <p>I'm using REST using Spring &amp; Java 1.7</p>
  
  <p>I've below model class:</p>
  
  <pre><code>private String name;
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  </code></pre>
  
  <p>And my controller is mapped to GET /person/info API. So, the controller fetches name &amp; shows it as JSON response.</p>
  
  <p>Here is the controller:</p>
  
  <pre><code> import org.springframework.web.bind.annotation.RequestBody;
   import org.springframework.web.bind.annotation.RequestHeader;
   import org.springframework.web.bind.annotation.RequestMapping;
   import org.springframework.web.bind.annotation.RequestMethod;
  
  @RequestMapping(value = "persons/info", method = RequestMethod.POST, consumes="application/json", produces="application/json")
  public ResponseEntity&lt;String&gt; getPersonInfo(@RequestBody String body) throws Exception {    
      String personInfo = null;
  
      MyServiceJson myServiceJson = MyServiceJsonFactory.getMyServiceObject(body);
  
      personInfo = myService.getPersonInfo(myServiceJson);
  
      HttpHeaders responseHeader = new HttpHeaders();
      return Util.getResponse(personInfo, responseHeader, HttpStatus.OK);
  }
  </code></pre>
  
  <p>I'm getting the JSON response as shown below:</p>
  
  <pre><code>{"name":"Jack"}
  </code></pre>
  
  <p>The problem is here is that this name string must be personName as shown below:</p>
  
  <pre><code>{"PersonName":"Jack"}
  </code></pre>
  
  <p>I believe it is taking the variable name from model &amp; sending it as it is. Can any one tell me if it is possible to have different attribute name as "PersonName" with some annotation change in REST service??</p>
  
  <p>I'll appreciate if someone can shed some light here!</p>
  
  <p>Thanks!</p>