Why is the json not being deserialized?

Asked

Viewed 43 times

0

I have the following JSON

{  
   "access_token":"QN3jzDYc7iOtMZM5ZdajAD-GhidnIK61PsXJfFOZFSxcsv-t4bxgoz_cq3hYfO3G9JqvkEVumet-IlwyQXIgJY9UX8sTIv3d1_MU8ZsLFl3EWb7QPPgs2sfpwa42d36M0sKwiSjPgIJJYio7aculk6FvZjSWnmv8CQb2IVo6t6_sKoqFr9QXgkY5NnH4_h20vWRB0wBD09X_xzMVEHwsgpQLTnAKHdvOi-eIcnvKIsnxSEMgKCKvFHKXkj9EWCvPAASzVlHdupf4qsmDWZWpVkmyAWOAXU1IXiu9Z9-HDqUxhxnpxuXj8kfVqdEn-fNMkE5u4RDqSBaWoKXS8QNkJRCOMixkqdQTtzZMILs6idy5IuHoipqdzQoX39wcHnYaBTMn8wL-8JZtWuMn1LBTq1HEgOw2NYeqm1IRRp2C5MDGR5N55W8clQIDUOjrhABM5A1-xFpPUi4RVGhRwUy_T8RoTSS-i0Is4ppXwAZH860",
   "token_type":"bearer",
   "expires_in":1799,
   "refresh_token":"EeBL1ngPWjL-oEsq61ZgiYGZCWZu_ekSL-J_GNxQok8dmE7ivelqb0pjDjh2uzs2ZAkJWMFBUpaSJ8AymhtMuLjHIOWL3k5lGviPtdFd-b-rbDqTNNZVmwF_hlHlkla58OzEVGn0Jp8YdC-w20K3Y2zDCJkGbDp82SfcqGJuOVRZqY6s-F-dq6uAVzUUw-8bdfMoYJUgSV3tFC9k90tx9x8-W0eQ6Qex02ww1OgocvH0a48kxphIYvqrTKG4xaZhFzpgxzcScqlI9h77EWpMyq8BgHM9Pk_1TSsX-E27PcRYa2NQqFeTOFpnoP3bd5nV4TwaBd0xkLblS1xf1au4-bHXHCwxPX_-239nruFD9dqYFy09bI3LF32ZodnsVYibdNKDUkw6sif4wsmd3J6EKGHlpjxRDdNgHKTJ46VjP_E0DVUseEf_KO0z2dqeDamNIW0yMNO1IYzf6PDBkS0ULlVqouiDk38ldL2DaVnKvHQ"
}

And I’m trying to deserialize for this object:

public class TokenVm { public string access_token { get; set; } public string token_type { get; set; } public string expires_in { get; set; } public string refresh_token { get; set; } }

That’s the code I’m using to deserialize:

var token = JsonConvert.DeserializeObject<TokenVm>(json);

You’re just falling into Exception :/

  • 2

    And what is Exception? Without this detail it is difficult to try to answer

  • I made a test here, works without error!

  • The Exception returned all null. I talked to the guy responsible for the api. He told me that the return is a string&#That must be why I can’t deserialize

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.