title: Spring ResponseEntity<JSONObject> HttpMediaTypeNotAcceptableException
body: <p>I try to return a JSONObject when a GET request is sent.</p>
  
  <p>The method</p>
  
  <pre><code>  @RequestMapping(value = "/{businessId}/{orderId}/{reportId}", method = RequestMethod.GET,
      produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public ResponseEntity&lt;JSONObject&gt; getReport(@PathVariable("businessId") String businessId,
                                                 @PathVariable("orderId") String orderId,
                                                 @PathVariable("reportId") Long reportId) throws JSONException {
      return new ResponseEntity&lt;JSONObject&gt;(reportService.getReportJSON(), HttpStatus.OK);
    }
  </code></pre>
  
  <p>I get json from a file. The is a single json object there. In one line. I parse it to JSONObject like this</p>
  
  <pre><code>  fs = FileSystem.get(uri, conf);
    BufferedReader reader = null;
    reader = new BufferedReader(new InputStreamReader(fs.open(path)));
    line = reader.readLine();
    while (line != null) {
      jsonObjectList = new JSONObject(line);
      line = reader.readLine();
    }
    return jsonObjectList;
  </code></pre>
  
  <p>This is what my file looks like.</p>
  
  <pre><code>{"reportId":"1","description":"СегментацияпоПоливозраст","orderId":"357","businessId":"НашКлиент№1","tables":[{"name":"Мужчины","fields":[{"name":"0-17","type":"number"},{"name":"18-24","type":"number"},{"name":"25-34","type":"number"},{"name":"35-44","type":"number"},{"name":"45-54","type":"number"},{"name":"45-54","type":"number"},{"name":"45-54","type":"number"}],"data":[2571,5287,4587,7705,3675,3743,7423]},{"name":"Женщины","fields":[{"name":"0-17","type":"number"},{"name":"18-24","type":"number"},{"name":"25-34","type":"number"},{"name":"35-44","type":"number"},{"name":"45-54","type":"number"},{"name":"45-54","type":"number"},{"name":"45-54","type":"number"}],"data":[7552,3107,6477,4967,9106,7859,9060]},{"name":"Мужчиныиженщины","fields":[{"name":"0-17","type":"number"},{"name":"18-24","type":"number"},{"name":"25-34","type":"number"},{"name":"35-44","type":"number"},{"name":"45-54","type":"number"},{"name":"45-54","type":"number"},{"name":"45-54","type":"number"}],"data":[7552,3107,6477,4967,9106,7859,9060]}]}
  </code></pre>
  
  <p>I use postman to check my methods. This is the error I get</p>
  
  <pre><code>{
      "timestamp": 1504020107350,
      "status": 406,
      "error": "Not Acceptable",
      "exception": "org.springframework.web.HttpMediaTypeNotAcceptableException",
      "message": "Not Acceptable",
      "path": "/audpro/report/1/1/1"
  }
  </code></pre>
  
  <p>I tried to create a jsonobject by hand and pass it, but got the same error</p>
  
  <pre><code>JSONObject response = new JSONObject();
  response.put("id", 555);
  response.put("message", "Provision successful!");
  return new ResponseEntity&lt;&gt;(response, HttpStatus.OK);
  </code></pre>
  
  <p>This is the library I use.</p>
  
  <pre><code>import org.codehaus.jettison.json.JSONObject;
  </code></pre>
  
  <p>Why can't I return a jsonobject?</p>