I have a JSONObject as shown below, in which the fields may vary at run time. I need to map this to a jsonb datatype field in postgres using jpa entity and to retrieve the same to JSONOject using JPARepository.
JSONObject jsonObj = new JSONObject();
jsonObj.put("name", "Tom");
jsonObj.put("birthday", "1940-02-10");
jsonObj.put("age", 76);
jsonObj.put("married", false);
jsonObj.put("favorite_foods", new String[] { "cookie", "fish",
"chips" });
String[]array in there - useJSONArray.