#Help - Java HashMap cannot be cast to class Author
1 messages ยท Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
Here is an AI assisted attempt to answer your question ๐ค. Maybe it helps! In any case, a human is on the way ๐. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
When i request directly Author with
{
"name": "Auteur 1",
"mail": "[email protected]"
}
work correctly
Detected code, here are some useful tools:
{
"name" : "Auteur 1", "mail" : "[email protected]"}
what kind of List is this?
it's just default list, here it's ArrayList
yep ... forcing by teacher ๐ข
its good lol
but i don't understand the probleme, why java detect HashMap when i request by project
Changed the category to Frameworks.
<@&987246452180930620> please have a look, thanks.
please share the entire stacktrace
not just the first line
How is that bad, this is very good, usually they are stuck in the past
ok sry for waiting so long
i've resolve my main problem, just to need to cast with a json (use jackson)
List<Author> deserializedAuthors = new ArrayList<>();
for (var i = 0; i < project.authors.size(); i++) {
Author author = new ObjectMapper().convertValue(project.authors.get(i), Author.class);
deserializedAuthors.add(author);
}
and it's work fine for me !
thx anyway !