I have a class pojo class
class A{
private List<String> colors;
// getters and setters.
}
The data comes in json format.
Data coming from database is ---- A {"colors":""}
The data should come in -- A{"colors":["red"]}.
The problem here is, java cann't convert data {"colors":""}
which in string to array {"colors":["red"]}
.Because of this I am getting InputMismatchException
.
Is there any way to convert {"colors":""}
to {"colors":["red"]}
?
I want to know how to handle this in java.
I am using jackson parser for converting json to java object.