Getting error while returning an object of type JsonArray

A

AOUADI Slim

Guest
I want to create a JsonArray from different JsonObject but I keep getting an error when i try to return the final JsonArray

"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 (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)"
myFunction :

@GetMapping("/statSysteme")
public JSONArray statSysteme() {
JSONArray jsonArray=new JSONArray();

List<MaBase> myList=(List<MaBase>) maBaseRepos.findAll();
for (int i = 0; i < myList.size(); i++) {
//System.out.println(myList.get(i).getMyText().getTheme().getSysteme().getNomSysteme()+"///"+myList.get(i).getStatusConformité());
JSONObject ja = new JSONObject();
ja.put("Nom Systeme",myList.get(i).getMyText().getTheme().getSysteme().getNomSysteme());
ja.put("Status Conformite",myList.get(i).getStatusConformité());
jsonArray.put(ja);
System.out.println(ja);
}


return jsonArray;
}

Continue reading...
 
Top