Click here to Skip to main content
15,909,373 members
Home / Discussions / C#
   

C#

 
QuestionScrolling reset when application regains focus Pin
pr1mem0ver29-Oct-18 2:58
pr1mem0ver29-Oct-18 2:58 
AnswerRe: Scrolling reset when application regains focus Pin
BillWoodruff29-Oct-18 11:55
professionalBillWoodruff29-Oct-18 11:55 
QuestionRookie needs help with array Pin
Member 1398787027-Oct-18 5:28
Member 1398787027-Oct-18 5:28 
AnswerRe: Rookie needs help with array Pin
Richard MacCutchan27-Oct-18 5:54
mveRichard MacCutchan27-Oct-18 5:54 
AnswerRe: Rookie needs help with array Pin
OriginalGriff27-Oct-18 6:12
mveOriginalGriff27-Oct-18 6:12 
GeneralRe: Rookie needs help with array Pin
Member 1398787028-Oct-18 12:39
Member 1398787028-Oct-18 12:39 
GeneralRe: Rookie needs help with array Pin
OriginalGriff28-Oct-18 20:58
mveOriginalGriff28-Oct-18 20:58 
Question[Solved]How i deserialize a specific JSON with Newtonsoft Pin
Kapparina26-Oct-18 13:35
Kapparina26-Oct-18 13:35 
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<IList<Player>>(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<ChampionRanks> 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<Player>(Json.Substring(1, Json.Length - 2));
Same here all the information in "RankedConquest" are null

After this I renamed "public class RankedConquest" to "public class Ranked" and add to my Player class :
public Ranked RankedConquest { get; set; }
Then :
player1.RankedConquest = JsonConvert.DeserializeObject<Player.Ranked>(profile);
Give me this error : Cannot deserialize the current JSON array

modified 27-Oct-18 16:37pm.

AnswerRe: How i deserialize a specific JSON with Newtonsoft Pin
josda100026-Oct-18 17:45
josda100026-Oct-18 17:45 
GeneralRe:How i deserialize a specific JSON with Newtonsoft Pin
Kapparina26-Oct-18 18:11
Kapparina26-Oct-18 18:11 
GeneralRe:How i deserialize a specific JSON with Newtonsoft Pin
josda100029-Oct-18 6:10
josda100029-Oct-18 6:10 
QuestionHow do i do this assignment???? Pin
C#NoobHelpMe25-Oct-18 16:49
C#NoobHelpMe25-Oct-18 16:49 
AnswerRe: How do i do this assignment???? Pin
OriginalGriff25-Oct-18 19:29
mveOriginalGriff25-Oct-18 19:29 
AnswerRe: How do i do this assignment???? Pin
Richard MacCutchan25-Oct-18 21:23
mveRichard MacCutchan25-Oct-18 21:23 
JokeRe: How do i do this assignment???? Pin
Peter_in_278025-Oct-18 21:50
professionalPeter_in_278025-Oct-18 21:50 
GeneralRe: How do i do this assignment???? Pin
Richard MacCutchan25-Oct-18 21:52
mveRichard MacCutchan25-Oct-18 21:52 
GeneralRe: How do i do this assignment???? Pin
OriginalGriff26-Oct-18 0:47
mveOriginalGriff26-Oct-18 0:47 
AnswerRe: How do i do this assignment???? Pin
Pete O'Hanlon26-Oct-18 1:40
mvePete O'Hanlon26-Oct-18 1:40 
GeneralRe: How do i do this assignment???? Pin
Eddy Vluggen26-Oct-18 8:33
professionalEddy Vluggen26-Oct-18 8:33 
QuestionBackground worker release resources Pin
udi altman24-Oct-18 8:00
udi altman24-Oct-18 8:00 
AnswerRe: Background worker release resources Pin
OriginalGriff24-Oct-18 20:01
mveOriginalGriff24-Oct-18 20:01 
AnswerRe: Background worker release resources Pin
Eddy Vluggen25-Oct-18 0:45
professionalEddy Vluggen25-Oct-18 0:45 
QuestionDataGridView with scrollbar is flickering Pin
Shine Ashraf23-Oct-18 23:40
Shine Ashraf23-Oct-18 23:40 
AnswerRe: DataGridView with scrollbar is flickering Pin
Eddy Vluggen23-Oct-18 23:48
professionalEddy Vluggen23-Oct-18 23:48 
GeneralRe: DataGridView with scrollbar is flickering Pin
Shine Ashraf24-Oct-18 0:03
Shine Ashraf24-Oct-18 0:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.