neuecc / Utf8Json

Definitely Fastest and Zero Allocation JSON Serializer for C#(NET, .NET Core, Unity, Xamarin).
MIT License
2.36k stars 267 forks source link

unable to Convert Google TokenResponse #108

Open nikhilintegration opened 6 years ago

nikhilintegration commented 6 years ago

I am trying to deserialize Google TokenResponse but utf8json is unable to deserialize the properties where JSONProperty is defined eg.JsonProperty("refresh_token") and same time I am able to deserialize the TokenManager using NewtonSoft.

TokenResponse tokenResponse = Utf8Json.JsonSerializer.Deserialize<TokenResponse>(fileContent); TokenResponse tokenResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TokenResponse>(fileContent);

Tornhoof commented 6 years ago

If you're refering to https://github.com/google/google-api-dotnet-client/blob/master/Src/Support/Google.Apis.Auth/OAuth2/Responses/TokenResponse.cs then you should probably take it up with google, as they use JSON.NET specific attributes [Newtonsoft.Json.JsonPropertyAttribute] to specify the json attribute names, instead of the more generic DataMemberAttribute.