c# - Deserializing JSON produces default class -


Text after item

I use this code

  PlayerData = JsonConvert.DeserializeObject & lt Deserializing; UserData & gt; (Response.Content);  

My UserData class is as follows:

  Public class UserData: BindableBase {public string UID {get; Set; } Public String UID {Received; Set; } Public Object liveID {get; Set; } Public Interval Time Final (to get); Set; } Public string country {receipt; Set; } Public String Username {get; Set; } Public string session {received; Set; } Public Internet servers {Receive; Set; } Public at Premium Cranesia {Receipt; Set; } Public UserData () {}} When it deserializes I returned an object, like I was just called to get  new UserData ()  but if I deserializes it correctly with the result Code: BindableBase  class definition I think the reason for this is that there are some properties in the base class that are not in JSON but I do not want to ignore them. ? InputifyPropertyChanged {Public: There  

BindableBase class is as follows: [Windows.Foundation.Metadata.WebHostHidden] [DataContract] Public Intangible Class BindableBase is a setting for this event Property changed changed event handler property; Protected bool SetProperty & LT; T & gt; (Reference T storage, T value, [CallerMemberName] string property = null) {if (object.Equals (storage, value)) return false; Storage = value; This.OnPropertyChanged (property); Back true; } Protected Zero onPropertyChanged ([CallerMemberName] string propertyName = null) {var eventHandler = this.PropertyChanged; If (eventHandler! = Null) {eventHandler (This is the new property change event event (propertyName)); JSON is as follows: "Country": "GB", "Country": "4", "UDID": "", "liveID": tap, "timeLastSeen": 1392730436, user name ":" User4 "," PremiumCurrency ":" 20 "," session ":" 5c8583311732fa816e333dc5e6426d65 "," serverTime ": +13 9 2730437}

this is a problem that has to answer clear enough DataContract property of the base class. The easiest way to fix this is to decorate the assets of the class derived with the DataMember attributes.


Comments