We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public enum GreetingType { ENGLISH, CHINESE, HAWAIIAN; } public class Greeting { private String word; public void setWord(String word) { this.word = word; } public String getWord() { return word; } } public class MyObj { private Integer id; private Map<GreetingType, Greeting> greetings; public void setId(Integer id) { this.id = id; } public Integer getId() { return id; } public void setGreetings(Map<GreetingType, Greeting> greetings) { this.greetings = greetings; } public Map<GreetingType, Greeting> getGreetings() { return greetings; } } // DOES NOT WORK: String json = "{\"id\": \"1\", \"greetings\": {\"ENGLISH\": {\"word\": \"hello\"} }, {\"CHINESE\": {\"word\": \"nihao\"} }, {\"HAWAIIAN\": {\"word\": \"aloha\"} } }"; MyObj myObj = JSON.std.beanFrom(MyObj.class, json); // keys of map greetings map are strings - not enums myObj.getGreetings().get(GreetingType.ENGLISH); // -> Error myObj.getGreetings().get("ENGLISH"); // -> Success // DATABIND ObjectMapper WORKS AS EXPECTED: ObjectMapper mapper = new ObjectMapper(); MyObj myObj = mapper.readValue(json, MyObj.class); myObj.getGreetings().get(GreetingType.ENGLISH); // -> Success
The text was updated successfully, but these errors were encountered:
Yup, probably not yet supported. Would be nice to support, for limited set of natively supported (by jackson jr) types.
Sorry, something went wrong.
Add a test for #21
df0be55
EnumReader not working for this case ...
No branches or pull requests
The text was updated successfully, but these errors were encountered: