Reputation: 658
I have large set of Json data returned from service. Now I want to convert this data to equivalent c# classes. Some Json data is related to metadata and some related to actual dataset. Json data is in flat hierarchy. I have tried JSON.Net as well but it converts the properties with same name. How i can convert the Json data in c# concrete classes ?
I have draw a rough picture but just for the basic understanding (I am not much good in drawing :) )
Upvotes: 0
Views: 483
Reputation: 151720
You say your JSON is actually a flat structure. Obviously JSON.NET has no notion of which properties belong to the actual days and which are metadata.
So let JSON.NET deserialize into the flat classes, and then map those classes into the nested classes that you want.
You can use AutoMapper for this.
Upvotes: 1