I'm having a string like below
MyString
[{"id":123,"name":"Abc"},{"id":124,"name":"EDF"}]
I need to convert/map this into my class(Test) using Set
Test
public class Test {
int id;
String name;
}
I've tried with the following method but didn't get succeed.
Set<Test> meds = (Set<Test>) (Object) MyString;
The Exception is
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Set