Multi depth unflattening + MapProperty #1896
-
|
First off, disclaimer - I don't fully understand the MapProperty syntax. The basic examples make sense, but when expanded to a complex scenario I don't understand. Specifically if using the square bracket notation I'm not sure what it is expecting. Therefore, this lack of understanding might be my problem... What I have is a flat C# object, which I want to unflatten over a multi depth JSON:API spec payload. This is my flattened object: And my unflattened JSON:API spec payload that I want to map the above flattened object over: Below is an example of the flattened object: And the unflattened JSON:API spec object I am attempting to create: This is my attempt at unflattening it with Mapperly: All this does is places the user ID in to the JObjectPayload ID IE: If anyone could help point out where I've gone wrong, or if what I'm attempting to do cannot be handled by Mapperly then I'd be very grateful! Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
If you use the array syntax, each item in the array is a segment in the resulting member path. |
Beta Was this translation helpful? Give feedback.
If you use the array syntax, each item in the array is a segment in the resulting member path.
So if you want a member path
"data.relationships.user.id"you need[nameof(JObjectPayload.data), nameof(JObjectPayload.data.relationships), nameof(JObjectPayload.data.relationships.user), nameof(JObjectPayload.data.relationships.user.id)].