title: No serializer found for class org.json.JSONArray and no properties discovered to create BeanSerializer
body: <blockquote>
    <p>No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)</p>
  </blockquote>
  
  <p>I am receiving the above error message when I'm trying to obtain a JSON array to pass into my datatable.</p>
  
  <p>I followed along with this previous StackOverflow question (<a href="https://stackoverflow.com/questions/26061781/no-serializer-found-for-class-org-json-jsonobject-and-no-properties-discovered-t">No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer</a>) to see if it would help, but I am still encountering the same issue.</p>
  
  <pre><code>@RequestMapping(value= "/loc_list", method = RequestMethod.GET)
  @ResponseBody
  public JSONArray getLocList(){
      List&lt;Locations&gt; locList = locations.findAll();
      JSONArray locArray = new JSONArray();
      for(int i = 0; i &lt; locList.size(); i++) {
          JSONObject locObj = new JSONObject();
          locObjObj.put("id", locObjList.get(i).getId());
          locObjObj.put("name", locObjList.get(i).getName());
          locObjObj.put("coordinates", locObjList.get(i).getCoordinates());
          locObjObj.put("description", locObjList.get(i).getDescription());
          System.out.println("Target # " + i + ": " + locObjObj.toString());
          locArray.put(locObjObj);
      }
      System.out.println("JSON Array " + locArray);
      return locArray;
  }
  </code></pre>
  
  <p>This is the output of the JSONArray (at the moment I only have one JSON Object, but would like to have multiple JSON objects in the future) </p>
  
  <pre><code>[{"name":"xxxx","coordinates":"42.3601° N, 71.0589° W","description":"city","id":3}]
  </code></pre>
  
  <p>I've modified my applicationContext.xml </p>
  
  <pre><code>&lt;context:component-scan base-package="com.A21.exceptions"/&gt;
  
  &lt;mvc:annotation-driven&gt;
   &lt;mvc:message-converters&gt;
    &lt;bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"&gt;
            &lt;property name="objectMapper" ref="jacksonObjectMapper" /&gt;
    &lt;/bean&gt;
   &lt;/mvc:message-converters&gt;
  &lt;/mvc:annotation-driven&gt;
  &lt;bean id="jacksonObjectMapper" class="com.A21.exceptions.MyJSONMapper" /&gt;
  </code></pre>
  
  <p>Created a new class also called MyJSONMapper.java:</p>
  
  <pre><code>package com.A21.exceptions;
  
  import com.fasterxml.jackson.databind.ObjectMapper;
  import com.fasterxml.jackson.databind.SerializationFeature;
  
  public class MyJSONMapper extends ObjectMapper {
   public MyJSONMapper() {
      this.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
   }
  }
  </code></pre>