Map object graph to Dictionary<string, object> #3915
-
Hey guys. I searched through Issues, Discussions, StackOverflow and Google, but I couldn't find anything relevant. Consider the following example:
Here's what AutoMapper returns: However, what I'm looking for is a recursive mapping of objects to The list of types that I'd like to map this way ( I tried several approaches, with just one being moderately successful: I used
Is there a way to make AutoMapper recursively map objects of specified types to Should I even be using AutoMapper here, or it's simply not the right tool for this particular use case? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Maybe it would be easier to serialize to |
Beta Was this translation helpful? Give feedback.
-
@lbargaoanu Thank you! JToken proved to be exactly what I was looking for. |
Beta Was this translation helpful? Give feedback.
Maybe it would be easier to serialize to
JToken
? Because otherwise you would probably need to write a custom object mapper. You would have more control, but I'm not sure you want that :)