Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
K

Kapparina

@Kapparina
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • [Solved]How i deserialize a specific JSON with Newtonsoft
    K Kapparina

    Thank you, I edited my code but all the data in player1.RankedConquest are still 0 or null Edit ------------------------------------------------------------------------------------------ Don't know why but all the code work fine now, thank you :thumbsup:

    C# collaboration json

  • [Solved]How i deserialize a specific JSON with Newtonsoft
    K Kapparina

    Hello , I have this Json :

    [
    {
    "Created_Datetime": "",
    "Id": ,
    "Last_Login_Datetime": "",
    "Leaves": 5,
    "Level": 102,
    "Losses": 552,
    "MasteryLevel": 39,
    "Name": "",
    "Personal_Status_Message": "",
    "Platform": "",
    "RankedConquest": {
    "Leaves": 0,
    "Losses": 21,
    "Name": "Conquest",
    "Points": 70,
    "PrevRank": 0,
    "Rank": 0,
    "Rank_Stat_Conquest": null,
    "Rank_Stat_Duel": null,
    "Rank_Stat_Joust": null,
    "Season": 2,
    "Tier": 15,
    "Trend": 0,
    "Wins": 14,
    "player_id": null,
    "ret_msg": null
    },
    "Region": "Europe",
    "TeamId": 0,
    "Team_Name": "",
    "Tier_Conquest": 15,
    "Total_Achievements": 51,
    "Total_Worshippers": 91811438,
    "Wins": 604,
    "ret_msg": null
    }
    ]

    And I can't deserialize it entirely with Newtonsoft What I have tried:

    var player1 = JsonConvert.DeserializeObject>(Json);

    But all the information in "RankedConquest" are null I have a class named Player :

    public class Player
    {
        public string Account\_Level { get; set; }
        public string ChampionName { get; set; }
        ...
        etc
        ...
        public IList m\_championslist;
        public class RankedConquest
        {
            public int Leaves { get; set; }
            public int Losses { get; set; }
            public string Name { get; set; }
            public int Points { get; set; }
            public int PrevRank { get; set; }
            public int Rank { get; set; }
            //Removed public object Rank\_Stat\_Conquest { get; set; }
            //Removed public object Rank\_Stat\_Duel { get; set; }
            //Removed public object Rank\_Stat\_Joust { get; set; }
            public int Season { get; set; }
            public int Tier { get; set; }
            public int Trend { get; set; }
            public int Wins { get; set; }
            //Removed public object player\_id { get; set; }
            public string ret\_msg { get; set; }// Edited
        }        
    }
    

    }

    With wich I can do :

            Player player1 = JsonConvert.DeserializeObject(Json.Substring(1, Json.Length - 2));
    

    Same here all the information in "RankedConquest" are null

    C# collaboration json
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups