I actually try to deserialize the next object in a unit test in accordance with Patreon
string json = @"{
""data"": {
""attributes"": {
""about"": """",
""created"": ""2017-04-01T12:00:00+00:00"",
""discord_id"": null,
""email"": ""james@mymail.com"",
""facebook"": null,
""facebook_id"": null,
""first_name"": ""Firstname"",
""full_name"": ""Fullname"",
""gender"": 0,
""has_password"": true,
""image_url"": ""https://c3.patreon.com/2/patreon-user/abc.jpg"",
""is_deleted"": false,
""is_email_verified"": true,
""is_nuked"": false,
""is_suspended"": false,
""last_name"": """",
""social_connections"": {
""deviantart"": null,
""discord"": null,
""facebook"": null,
""spotify"": null,
""twitch"": null,
""twitter"": null,
""youtube"": null
},
""thumb_url"": ""https://c3.patreon.com/2/patreon-user/abc.jpg"",
""twitch"": null,
""twitter"": null,
""url"": ""https://www.patreon.com/user?u=123456"",
""vanity"": null,
""youtube"": null
},
""id"": ""123456"",
""relationships"": {
""pledges"": {
""data"": []
}
},
""type"": ""user""
},
""links"": {
""self"": ""https://api.patreon.com/user/123456""
}
}";
But my attributes object or array is polymorphic, it can be User like my exemple but other object types, and I don't know how to do.
I tried something like that but without success.
And second question, how is it possible to flattern attributes in same user class with id and relationships.
EDIT: To anwser to my question, I found a better solution than "Duplicate" : http://jsonapi.org/