자바

spring 3.0 json한글처리

숨쉬는 개발자 2017. 9. 1. 14:21
반응형


@RequestMapping(value = "")

public ResponseEntity<String> convert() throws Exception {

     

 

    // 응답헤더 지정

    HttpHeaders httpheaders = new HttpHeaders();

    httpheaders.add("Content-Type", "application/json;charset=UTF-8");

 

     

    // Json 결과값 : {"name": "이름","age": 18}

    String json = "{\"name\": \"이름\",\"age\": 18}" ;

     

     

    return new ResponseEntity<String>(json, httpheaders, HttpStatus.CREATED) ;

 

 

 

}