Posted
Filed under JSP, JAVA
add follow pom.xml

<dependency>
  <groupId>org.json</groupId>
  <artifactId>json</artifactId>
  <version>20140107</version>
</dependency>

version is 20140107 <-- jdk 6 compiled ...
and higher version is occured error

[useable]
wirte this sentense to  youer controller and define  @ResponseBody anotation 
becouse @ResponseBody =>  noting header and nothing footer  , only body

@RequestMapping(value = "/code/code_get_json", produces="text/plain;charset=UTF-8" ,  method = RequestMethod.GET)
 public @ResponseBody String code_get_json(@RequestParam("cd_pid") String cd_pid){
  ArrayList<CodeVO> codelist   = null ;
  codelist = (ArrayList<CodeVO>)codeService.code_list(cd_pid);
  JSONArray json = new JSONArray(codelist);
  return json.toString();
 }

[refference]
https://github.com/douglascrockford/JSON-java


2014/12/31 11:48 2014/12/31 11:48