title: Error: No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer
body: <p>I am getting this error
  <strong>&quot;nested exception is org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class org.json.JSONObject]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer&quot;</strong> when running the project. I tried many solutions I found through this platform but those are didnt worked for me. Is it this is the case or any other? If so please help me to solve this issue.</p>
  <p>Below is the RowEvent.java class.</p>
  <pre><code>@Component(&quot;support.support-provider.row-event&quot;)
  public class RowEventSupportProvider extends SupportProvider {
  
      @Override
      public SupportResponse search(SearchData searchData) throws JSONException {
          JSONObject supportProvider = new JSONObject();
          supportProvider.put(&quot;startDate&quot;, searchData.getStartDate());
          supportProvider.put(&quot;startTime&quot;, searchData.getStartTime());
          supportProvider.put(&quot;endDate&quot;, searchData.getEndDate());
          supportProvider.put(&quot;endTime&quot;, searchData.getEndTime());
          supportProvider.put(&quot;clientId&quot;, searchData.getClientId());
          supportProvider.put(&quot;launchContextId&quot;, searchData.getLaunchContextId());
          supportProvider.put(&quot;integrationId&quot;, searchData.getIntegrationId());
          supportProvider.put(&quot;deploymentId&quot;, searchData.getDeploymentId());
          supportProvider.put(&quot;courseId&quot;, searchData.getCourseId());
          supportProvider.put(&quot;courseType&quot;, searchData.getCourseType());
          supportProvider.put(&quot;assignmentId&quot;, searchData.getAssignmentId());
          supportProvider.put(&quot;assignmentType&quot;, searchData.getAssignmentType());
          supportProvider.put(&quot;userId&quot;, searchData.getUserId());
          supportProvider.put(&quot;userType&quot;, searchData.getUserType());
  
          SupportResponse supportResponse = new SupportResponse();
          supportResponse.setData(supportProvider);
          return supportResponse;
      }
  }
  </code></pre>
  <p>SupportResponse.java</p>
  <pre><code>    import com.fasterxml.jackson.annotation.JsonAutoDetect;
  import org.json.JSONObject;
  import org.springframework.hateoas.Links;
  import org.springframework.hateoas.RepresentationModel;
  
  import java.util.List;
  @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
  public class SupportResponse extends RepresentationModel&lt;SupportResponse&gt;
  {
          String id;
          Object data;
          List&lt;Links&gt; links;
  
          public String getId() {
                  return id;
          }
  
          public void setId(String id) {
                  this.id = id;
          }
  
          public Object getData() {
                  return data;
          }
  
          public void setData(Object data) {
                  this.data = data;
          }
  }
  </code></pre>