@PostMapping(“/saveUser”)
public void saveSingleUser(@RequestBody JSONObject jsonObject)
{
//code block
}
this is my post api which takes jsonObject as param, I am trying to test it via postman i did all config in it like content-type : application/json, i also did “response.setContentType(“application/json”);
response.setCharacterEncoding(“UTF-8″); ” in my api but when i print it after these lines of my code block in my api i get empty json {} as i print why so? I DO NOT want to set java object as my api param i also have few json dependcy in my gradle build file.
my main problem is : first i used to set json same as my user pojo but now I’m adding a other table’s field that is role field so therefore a custom json is going to my api but it seems empty when it comes to my api
i tried adding dependencies by asking same to chatgpt, phind but it wasn’t much helpful tho. i am expecting to see a the custom json i sent from postman
Dipak Zad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.