Q: How to do a specific operation to only certain fields in a Java object or a JSON payload I have a spring boot microservices application and within it, I want to do a specific operation (say some string manip) on specific fields of a Java object (or a JSON object).
For example: 
class Employee {

private String id;
private String name;
private String someOtherId;

}

If I need to do a specific operation only to id and someOtherId fields, how can go about it? Can there be custom annotations created to handle this?
Something like:
stringAppend(employee) should do this operation to only the specific fields. I don't want to check iteratively inside the function, rather I would do it via configuration.
The object will be a payload from a HTTPRequest and need to do this manipulation specifically to only certain fields.

A: For manipulating the specific fields of received object in HTTP request payload, you can use Jackson library in Java. Jackson is a very popular and efficient java based library to serialize or map java objects to JSON and vice versa.
In this case from http request body, Employee object will be in serialized formed.
To deserialized it to actual Employee object you can use ObjectMapper from Jackson library as follows :
Assume payloadJson is a string which contains request payload in JSON format. 
ObjectMapper objectMapper = new ObjectMapper();
Employee employee = objectMapper.readValue(payloadJson, Employee.class);
After desrialization you can perform manipulation on fields of Employee object using Getters and Setters method.
