{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/7824","repository_url":"https://api.github.com/repos/aspnet/Mvc","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/7824/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/7824/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/7824/events","html_url":"https://github.com/aspnet/Mvc/issues/7824","id":326130264,"number":7824,"title":"Make the ModelBinder support the JsonPropertyAttribute","user":{"login":"gregoryagu","id":3810620,"avatar_url":"https://avatars0.githubusercontent.com/u/3810620?v=4","gravatar_id":"","url":"https://api.github.com/users/gregoryagu","html_url":"https://github.com/gregoryagu","followers_url":"https://api.github.com/users/gregoryagu/followers","following_url":"https://api.github.com/users/gregoryagu/following{/other_user}","gists_url":"https://api.github.com/users/gregoryagu/gists{/gist_id}","starred_url":"https://api.github.com/users/gregoryagu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregoryagu/subscriptions","organizations_url":"https://api.github.com/users/gregoryagu/orgs","repos_url":"https://api.github.com/users/gregoryagu/repos","events_url":"https://api.github.com/users/gregoryagu/events{/privacy}","received_events_url":"https://api.github.com/users/gregoryagu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-24T13:48:00Z","updated_at":"2018-05-24T19:56:44Z","closed_at":null,"author_association":"NONE","body":"#### Is this a Bug or Feature request?:\r\nFeature\r\n\r\n\r\n#### Steps to reproduce (preferrably a link to a GitHub repo with a repro project):\r\nTry to bind to \"smtp-id\" in a web api call.  It cannot be done, as the dash is not allowed in a property name.  \r\n\r\n#### Description of the problem:\r\nBut there is no way to put an attribute on the Input Model to tell the ModelBinder to bind to \"SmtpId\"\r\n\r\npublic class InputModel{\r\n     [JsonProperty(\"smpt-id\")]//It would be great if this would work.\r\n     public string SmtpId{get;set;}\r\n}\r\n\r\nI encountered this issue trying to process SendGrid event hooks.  They use the dash and I cannot get them to change it.\r\n\r\n#### Version of `Microsoft.AspNetCore.Mvc` or `Microsoft.AspNetCore.App` or `Microsoft.AspNetCore.All`: 2.02\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/391839414","html_url":"https://github.com/aspnet/Mvc/issues/7824#issuecomment-391839414","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/7824","id":391839414,"user":{"login":"pranavkm","id":174281,"avatar_url":"https://avatars2.githubusercontent.com/u/174281?v=4","gravatar_id":"","url":"https://api.github.com/users/pranavkm","html_url":"https://github.com/pranavkm","followers_url":"https://api.github.com/users/pranavkm/followers","following_url":"https://api.github.com/users/pranavkm/following{/other_user}","gists_url":"https://api.github.com/users/pranavkm/gists{/gist_id}","starred_url":"https://api.github.com/users/pranavkm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pranavkm/subscriptions","organizations_url":"https://api.github.com/users/pranavkm/orgs","repos_url":"https://api.github.com/users/pranavkm/repos","events_url":"https://api.github.com/users/pranavkm/events{/privacy}","received_events_url":"https://api.github.com/users/pranavkm/received_events","type":"User","site_admin":false},"created_at":"2018-05-24T19:56:44Z","updated_at":"2018-05-24T19:56:44Z","author_association":"MEMBER","body":"You should be able to annotate your property with `[ModelBinder(Name = \"smtp-id\")]` if you're dealing with model bound objects. That said, it looks like SendGrid uses Json payloads - https://sendgrid.com/docs/API_Reference/Event_Webhook/event.html#-Events - at which point, annotating it with `JsonProperty` would be right thing since the model would get deserialized by Json.NET"}}
{"actor":{"display_login":"pranavkm"}}