Skip to content
New issue

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

ObjectMapper doesn't appear to support lists #1026

Open
distinctdan opened this issue Jan 21, 2025 · 3 comments
Open

ObjectMapper doesn't appear to support lists #1026

distinctdan opened this issue Jan 21, 2025 · 3 comments
Labels
type: question Further information is requested

Comments

@distinctdan
Copy link

Expected Behavior

I'm trying to deserialize a json array of objects, but all the documentation only has single objects. I expect ObjectMapper actually does support this, but until you guys document it, I don't have any way to know how to get it to work. I'm probably going to have to go digging in the source again to get this figured out. I'm using Kotlin, but I expect this is a common use case even from the Java side.

Here's an example of what I'm trying to do:

val foo = objectMapper.readValue(someJson, List<Book>)

Actual Behaviour

This should be supported and documented.

Steps To Reproduce

No response

Environment Information

No response

Example Application

No response

Version

4.7.4

@davisjose19
Copy link

I had the same issue. It is not able to read it.

@graemerocher
Copy link
Contributor

syntax is val foo = objectMapper.readValue(someJson, Argument.listOf(Book.class))

@graemerocher graemerocher added the type: question Further information is requested label Jan 27, 2025
@distinctdan
Copy link
Author

Thanks, that works! Now for the docs, you guys have put in a lot of work in to build a nice serialization library, it would be a shame if people don't use it because they don't know how. Could we please get one of the maintainers to document their work? It wouldn't take them long, and it would actually save you guys time in the long run because you wouldn't have to answer basic questions like this one. I like Micronaut a lot, but there are a lot of basic things missing in the docs, and I'm always having to go waste hours searching through stack overflow or reading the source to figure out how to do stuff. If you guys are going to invest all the time to develop nice features, I would just request that you spend the extra 5% of the time to document the hard work you've put in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants