I have a rest API set up that accepts a JSON request and maps it to a POJO. My question is, what is the best practice or how do I validate that the JSON that is being sent contains valid data before continuing on and processing further logic? If it's invalid, I want to send a message back to the user to indicate that the request was bad. Do I have to iterate through every possible field and check them? For example, let's say I'm expecting a value for a field that will end up being a main data element for my
java object, how can I verify it is there? Thanks in advance for the help.