Nagarro interview question

How to accept different formats in REST service (XML , JSON)