1

I am getting Json from third party API, it contain invalid field names like ".issued" and ".expires". How can I convert the Json to a C# class.

{
    "access_token": "fdsfdsfds3243243",
    ".issued": "Thu, 02 Aug 2018 08:14:25 GMT",
    ".expires": "Thu, 16 Aug 2018 08:14:25 GMT"
}
TheTanic
  • 1,510
  • 15
  • 29
Rizwan Ali
  • 21
  • 6
  • The same as any other, depending on the library you use. Search SO for "JSON.NET mapping" – Panagiotis Kanavos Aug 02 '18 at 09:19
  • Is the missing ',' in line 2 on purpose? – TheTanic Aug 02 '18 at 09:20
  • See [this question](https://stackoverflow.com/questions/15915503/net-newtonsoft-json-deserialize-map-to-a-different-property-name) which should help you answer your own question. – Jaffacakes82 Aug 02 '18 at 09:21
  • public partial class Root { [JsonProperty("access_token")] public string AccessToken { get; set; } [JsonProperty(".issued")] public string Issued { get; set; } [JsonProperty(".expires")] public string Expires { get; set; } } – Cetin Basoz Aug 02 '18 at 09:23

0 Answers0