Why do I need it ? I got some JSON data from game and I put them to object with specified structure.
Struct of my object:
Code:
public partial class JsonObjects { [JsonProperty("data")] public Data Data { get; set; } } public partial class Data { [JsonProperty("user")] public User User { get; set; } [JsonProperty("character")] public Character Character { get; set; } } public partial class User { [JsonProperty("id")] public long? Id { get; set; } [JsonProperty("email")] public string Email { get; set; } } public partial class Character { [JsonProperty("name")] public string Name { get; set; } [JsonProperty("game_currency")] public long? GameCurrency { get; set; } }
Code:
JsonObjects destination = new JsonObjects(); string html; while(true){ html= GetFreshData(); JsonObjects newData = JsonConvert.DeserializeObject<JsonObjects>(html); // put NEW data from obj: "newData" to "destination" }
Thank you !