I want to serialize the different types of lists by using object mapper, but I do not know how to pass the different types of list objects into object Mapper at a time. T
Simply try:
ObjectMapper objMapper = new ObjectMapper();
String jsonString = objMapper.writeValueAsString(simpleUomList);
Edit according to the comment:
You need to create a class wrapping your two lists and then write it:
public class MyLists {
private List<TaxCategory> taxCategoryList;
private List<SimpleUom> simpleUomList;
// + constructor, getters and setters
}
ObjectMapper objMapper = new ObjectMapper();
MyLists myLists = new MyLists(taxCategoryList, simpleUomList);
String jsonString = objMapper.writeValueAsString(myLists);