Неверный результат с парсинге JSON - C#

Узнай цену своей работы

Формулировка задачи:

{"error":false,"success":true,"text":"Games loaded.","date":1440079346,"etag":"ba095d9488bbd61233940ac342e414aa","games":[ ["29539","The Chaos Engine","the-chaos-engine",0,5,1,9,39,"\/1\/30\/29539\/crop_160x220\/boxshot.jpg","1396916375","Released Apr 7, 2014","","Prepare for a dark world, a Victorian age of discovery and technology corrupted by a failed early computer.",9.99,"$9.99",0,"",0,{"pc":"Windows","linux":"Linux","mac":"Mac"},"2133",64,7,1,[8],"6026",0,0], ["24986","Cube & Star: An Arbitrary Love","cube-star-an-arbitrary-love",0,1,2,18,2,"\/1\/25\/24986\/crop_160x220\/DesuraBoxArt_9.png","1396717200","Released Apr 5, 2014","","Spread color. Spread joy. Thrill to the emergence of strange new creatures. And burn them all to ashes.",4.99,"$4.99",0,"",0,{"pc":"Windows","linux":"Linux64","mac":"Mac"},"710",72,6,5,[8],"5940",0,0], ["29462","Magicka - Wizards of the Square Tablet","magicka-wizards-of-the-square-tablet",0,1,2,4,20,"\/1\/30\/29462\/crop_160x220\/imagicka_cover.jpg","1395710158","Released Mar 24, 2014","","Adventure through the fantasy campaign by yourself, or \"accidentally\" obliterate your friends in multiplayer co-op!",4.99,"$4.99",0,"",0,{"pc":"Windows"},"1805",46,7,1,[8],"5931",8,0], ["29461","Card City Nights","card-city-nights",0,1,2,4,16,"\/1\/30\/29461\/crop_160x220\/ccn_cover.jpg","1395707536","Released Mar 24, 2014","","Card City Nights is an adventure through a city filled with card-nuts and lunatics.",3.99,"$3.99",0,"",0,{"pc":"Windows","linux":"Linux64","mac":"Mac"},"1790",60,11,14,[8],"5930",8,0], ["29459","Ittle Dew","ittle-dew",0,1,2,4,2,"\/1\/30\/29459\/crop_160x220\/id_cover.jpg","1395705033","Released Mar 24, 2014","","Ittle Dew boils down the classic adventure formula until there is only fun left. ",13.99,"$13.99",0,"",0,{"pc":"Windows","linux":"Linux64","mac":"Mac"},"1817",55,11,5,[8],"5929",8,0], ["29457","Muri","muri",0,1,1,9,19,"\/1\/30\/29457\/crop_160x220\/muri_cover.jpg","1395700050","Released Mar 24, 2014",""," When Mars suddenly vanishes, one woman sets out to discover the fate of humanity.",3.99,"$3.99",0,"",0,{"pc":"Windows"},"1580",64,11,5,[8],"5925",8,0], ["29250","Super Killer Hornet: Resurrection","super-killer-hornet-resurrection",0,1,2,9,39,"\/1\/30\/29250\/crop_160x220\/PC_cover_art.png","1394650800","Released Mar 12, 2014","","An intense vertical shooter with a brain train twist. Through the chaos try to answer the falling math problems!",9.99,"$9.99",0,"",0,{"pc":"Windows"},"2723",83,4,1,[8],"5792",0,0], ["17128","Humans Must Answer","humans-must-answer",0,1,2,9,39,"\/1\/18\/17128\/crop_160x220\/boxshot.jpg","1392885763","Released Feb 20, 2014","","Dodge, shoot and explode across the Solar System as a crew of intelligent and dangerous chickens!",9.99,"$9.99",0,"",0,{"pc":"Windows"},"2737",80,3,1,[8],"5754",0,0], ["23705","Fields of War","fields-of-war",0,2,2,9,34,"\/1\/24\/23705\/crop_160x220\/Boxshot.png","1389812400","Released Jan 15, 2014","","Fields of War is a massive multiplayer third-person-shooter focused on large scale battles!",14.99,"$14.99",0,"",0,{"pc":"Windows","linux":"Linux64","mac":"Mac"},"1779",74,11,1,[],"5497",0,0], ["17483","Stonerid","stonerid",0,1,2,13,19,"\/1\/18\/17483\/crop_160x220\/stonerid_box_1.png","1387382400","Released Dec 18, 2013","","Stonerid is an unusual and really difficult 2D platformer with wonderful artwork!",4.99,"$4.99",0,"",0,{"pc":"Windows"},"1660",88,5,5,[8],"5394",0,0], ["27719","Mitsurugi Kamui Hikae","mitsurugi-kamui-hikae",0,1,2,1,20,"\/1\/28\/27719\/crop_160x220\/mitsurugi_Boxshot.png","1385512682","Released Nov 26, 2013","","Use lightning fast sword slashes, hand-to-hand attacks and ancient techniques to defeat waves of demonic foes.",14.99,"$14.99",0,"",0,{"pc":"Windows"},"459",79,34,1,[8],"5355",0,0], ["23565","NarcoGuerra","narcoguerra",0,3,2,10,16,"\/1\/24\/23565\/crop_160x220\/Desura_Boxart1.png","1384444800","Released Nov 14, 2013","","NarcoGuerra puts you in the frontline of one of the most dangerous conflicts ever!",2.99,"$2.99",0,"",0,{"pc":"Windows","mac":"Mac"},"1168",58,13,14,[],"4468",0,0]]}
Вот сам JSON который возвращает сайт! Рассмотрю на 1 строке... Нужно вытащить "29539", "The Chaos Engine", "6026" - (На след строке) Раньше просто разбирал Substringom и IndexOf . Но тут какую то дичь вернуло... Не могу справиться с данной проблемой. Все 3 параметра надо разобрать по List<string> ... Сделайте пожалуйста, кто в JSON соображает. Есть возможность материально вознаградить)

Решение задачи: «Неверный результат с парсинге JSON»

textual
Листинг программы
  public class SimpleClass
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Something { get; set; }
 
        public override string ToString()
        {
            return string.Format("{0} {1} ({2})", ID, Name, Something);
        }
    }
 
    class Program
    {
        static void Main(string[] args)
        {
            string json = @"
{'error':false,'success':true,'text':'Games loaded.','date':1440079346,'etag':'ba095d9488bbd61233940ac342e414aa','games':[
 
 ['29539','The Chaos Engine','the-chaos-engine',0,5,1,9,39,'\/1\/30\/29539\/crop_160x220\/boxshot.jpg','1396916375','Released Apr 7, 2014','','Prepare for a dark world, a Victorian age of discovery and technology corrupted by a failed early computer.',9.99,'$9.99',0,'',0,{'pc':'Windows','linux':'Linux','mac':'Mac'},'2133',64,7,1,[8],'6026',0,0],
 
 ['24986','Cube & Star: An Arbitrary Love','cube-star-an-arbitrary-love',0,1,2,18,2,'\/1\/25\/24986\/crop_160x220\/DesuraBoxArt_9.png','1396717200','Released Apr 5, 2014','','Spread color. Spread joy. Thrill to the emergence of strange new creatures. And burn them all to ashes.',4.99,'$4.99',0,'',0,{'pc':'Windows','linux':'Linux64','mac':'Mac'},'710',72,6,5,[8],'5940',0,0],
 
 ['29462','Magicka - Wizards of the Square Tablet','magicka-wizards-of-the-square-tablet',0,1,2,4,20,'\/1\/30\/29462\/crop_160x220\/imagicka_cover.jpg','1395710158','Released Mar 24, 2014','','Adventure through the fantasy campaign by yourself, or \'accidentally\' obliterate your friends in multiplayer co-op!',4.99,'$4.99',0,'',0,{'pc':'Windows'},'1805',46,7,1,[8],'5931',8,0],
 
 ['29461','Card City Nights','card-city-nights',0,1,2,4,16,'\/1\/30\/29461\/crop_160x220\/ccn_cover.jpg','1395707536','Released Mar 24, 2014','','Card City Nights is an adventure through a city filled with card-nuts and lunatics.',3.99,'$3.99',0,'',0,{'pc':'Windows','linux':'Linux64','mac':'Mac'},'1790',60,11,14,[8],'5930',8,0],
 
 ['29459','Ittle Dew','ittle-dew',0,1,2,4,2,'\/1\/30\/29459\/crop_160x220\/id_cover.jpg','1395705033','Released Mar 24, 2014','','Ittle Dew boils down the classic adventure formula until there is only fun left. ',13.99,'$13.99',0,'',0,{'pc':'Windows','linux':'Linux64','mac':'Mac'},'1817',55,11,5,[8],'5929',8,0],
 
 ['29457','Muri','muri',0,1,1,9,19,'\/1\/30\/29457\/crop_160x220\/muri_cover.jpg','1395700050','Released Mar 24, 2014','',' When Mars suddenly vanishes, one woman sets out to discover the fate of humanity.',3.99,'$3.99',0,'',0,{'pc':'Windows'},'1580',64,11,5,[8],'5925',8,0],
 
 ['29250','Super Killer Hornet: Resurrection','super-killer-hornet-resurrection',0,1,2,9,39,'\/1\/30\/29250\/crop_160x220\/PC_cover_art.png','1394650800','Released Mar 12, 2014','','An intense vertical shooter with a brain train twist. Through the chaos try to answer the falling math problems!',9.99,'$9.99',0,'',0,{'pc':'Windows'},'2723',83,4,1,[8],'5792',0,0],
 
 ['17128','Humans Must Answer','humans-must-answer',0,1,2,9,39,'\/1\/18\/17128\/crop_160x220\/boxshot.jpg','1392885763','Released Feb 20, 2014','','Dodge, shoot and explode across the Solar System as a crew of intelligent and dangerous chickens!',9.99,'$9.99',0,'',0,{'pc':'Windows'},'2737',80,3,1,[8],'5754',0,0],
 
 ['23705','Fields of War','fields-of-war',0,2,2,9,34,'\/1\/24\/23705\/crop_160x220\/Boxshot.png','1389812400','Released Jan 15, 2014','','Fields of War is a massive multiplayer third-person-shooter focused on large scale battles!',14.99,'$14.99',0,'',0,{'pc':'Windows','linux':'Linux64','mac':'Mac'},'1779',74,11,1,[],'5497',0,0],
 
 ['17483','Stonerid','stonerid',0,1,2,13,19,'\/1\/18\/17483\/crop_160x220\/stonerid_box_1.png','1387382400','Released Dec 18, 2013','','Stonerid is an unusual and really difficult 2D platformer with wonderful artwork!',4.99,'$4.99',0,'',0,{'pc':'Windows'},'1660',88,5,5,[8],'5394',0,0],
 
 ['27719','Mitsurugi Kamui Hikae','mitsurugi-kamui-hikae',0,1,2,1,20,'\/1\/28\/27719\/crop_160x220\/mitsurugi_Boxshot.png','1385512682','Released Nov 26, 2013','','Use lightning fast sword slashes, hand-to-hand attacks and ancient techniques to defeat waves of demonic foes.',14.99,'$14.99',0,'',0,{'pc':'Windows'},'459',79,34,1,[8],'5355',0,0],
 
 ['23565','NarcoGuerra','narcoguerra',0,3,2,10,16,'\/1\/24\/23565\/crop_160x220\/Desura_Boxart1.png','1384444800','Released Nov 14, 2013','','NarcoGuerra puts you in the frontline of one of the most dangerous conflicts ever!',2.99,'$2.99',0,'',0,{'pc':'Windows','mac':'Mac'},'1168',58,13,14,[],'4468',0,0]]}
        ";
 
            JObject.Parse(json)["games"]
                .Children()
                .Select(j => new SimpleClass
                            {
                                ID = (int)j[0],
                                Name = (string)j[1],
                                Something = (string)j[24]
                            })
               .ToList()
               .ForEach(x => Console.WriteLine(x));
        }
    }

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

15   голосов , оценка 4 из 5