Click here to Skip to main content
15,887,930 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I can not deserialize the current JSON format. When I try to use some tools to generate the deserialize object it generates something like that ;

C#
public class RootObject
{
    public List<list><>> ImageList { get; set; }
}


JSON Format ;

HTML
{"ImageList": [
      [
        {
          "Key": "RAW",
          "Value": {
            "Height": 0,
            "Name": "j6588_65014_7c42d8c3622d1b187467a35158395167.jpg",
            "TimeStamp": "201504171152",
            "Type": 1,
            "Width": 0
          }
        },
        {
          "Key": "480x360",
          "Value": {
            "Height": 360,
            "Name": "j6588_65014_7c42d8c3622d1b187467a35158395167.jpg",
            "TimeStamp": "201504171152",
            "Type": 1,
            "Width": 480
          }
        },
        {
          "Key": "240x180",
          "Value": {
            "Height": 180,
            "Name": "j6588_65014_7c42d8c3622d1b187467a35158395167.jpg",
            "TimeStamp": "201504171152",
            "Type": 1,
            "Width": 240
          }
        },
        {
          "Key": "120x120",
          "Value": {
            "Height": 120,
            "Name": "j6588_65014_7c42d8c3622d1b187467a35158395167.jpg",
            "TimeStamp": "201504171152",
            "Type": 1,
            "Width": 120
          }
        },
        {
          "Key": "60x60",
          "Value": {
            "Height": 60,
            "Name": "j6588_65014_7c42d8c3622d1b187467a35158395167.jpg",
            "TimeStamp": "201504171152",
            "Type": 1,
            "Width": 60
          }
        }
      ],
      [
        {
          "Key": "RAW",
          "Value": {
            "Height": 0,
            "Name": "j6588_74667_62018a05df91dd07ae31d81c80fa8520.jpg",
            "TimeStamp": "201507021418",
            "Type": 4,
            "Width": 0
          }
        },
        {
          "Key": "480x360",
          "Value": {
            "Height": 360,
            "Name": "j6588_74667_62018a05df91dd07ae31d81c80fa8520.jpg",
            "TimeStamp": "201507021418",
            "Type": 4,
            "Width": 480
          }
        },
        {
          "Key": "240x180",
          "Value": {
            "Height": 180,
            "Name": "j6588_74667_62018a05df91dd07ae31d81c80fa8520.jpg",
            "TimeStamp": "201507021418",
            "Type": 4,
            "Width": 240
          }
        },
        {
          "Key": "120x120",
          "Value": {
            "Height": 120,
            "Name": "j6588_74667_62018a05df91dd07ae31d81c80fa8520.jpg",
            "TimeStamp": "201507021418",
            "Type": 4,
            "Width": 120
          }
        },
        {
          "Key": "60x60",
          "Value": {
            "Height": 60,
            "Name": "j6588_74667_62018a05df91dd07ae31d81c80fa8520.jpg",
            "TimeStamp": "201507021418",
            "Type": 4,
            "Width": 60
          }
        }
      ],
      [
        {
          "Key": "RAW",
          "Value": {
            "Height": 0,
            "Name": "j6588_74629_e13f33133cbb6ac73f862b1f27051df7.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 0
          }
        },
        {
          "Key": "480x360",
          "Value": {
            "Height": 360,
            "Name": "j6588_74629_e13f33133cbb6ac73f862b1f27051df7.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 480
          }
        },
        {
          "Key": "240x180",
          "Value": {
            "Height": 180,
            "Name": "j6588_74629_e13f33133cbb6ac73f862b1f27051df7.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 240
          }
        },
        {
          "Key": "120x120",
          "Value": {
            "Height": 120,
            "Name": "j6588_74629_e13f33133cbb6ac73f862b1f27051df7.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 120
          }
        },
        {
          "Key": "60x60",
          "Value": {
            "Height": 60,
            "Name": "j6588_74629_e13f33133cbb6ac73f862b1f27051df7.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 60
          }
        }
      ],
      [
        {
          "Key": "RAW",
          "Value": {
            "Height": 0,
            "Name": "j6588_74627_4376a216da497c69d954627508470010.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 0
          }
        },
        {
          "Key": "480x360",
          "Value": {
            "Height": 360,
            "Name": "j6588_74627_4376a216da497c69d954627508470010.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 480
          }
        },
        {
          "Key": "240x180",
          "Value": {
            "Height": 180,
            "Name": "j6588_74627_4376a216da497c69d954627508470010.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 240
          }
        },
        {
          "Key": "120x120",
          "Value": {
            "Height": 120,
            "Name": "j6588_74627_4376a216da497c69d954627508470010.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 120
          }
        },
        {
          "Key": "60x60",
          "Value": {
            "Height": 60,
            "Name": "j6588_74627_4376a216da497c69d954627508470010.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 60
          }
        }
      ],
      [
        {
          "Key": "RAW",
          "Value": {
            "Height": 0,
            "Name": "j6588_74625_8c7d09462a0599543191b7844dec6fd2.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 0
          }
        },
        {
          "Key": "480x360",
          "Value": {
            "Height": 360,
            "Name": "j6588_74625_8c7d09462a0599543191b7844dec6fd2.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 480
          }
        },
        {
          "Key": "240x180",
          "Value": {
            "Height": 180,
            "Name": "j6588_74625_8c7d09462a0599543191b7844dec6fd2.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 240
          }
        },
        {
          "Key": "120x120",
          "Value": {
            "Height": 120,
            "Name": "j6588_74625_8c7d09462a0599543191b7844dec6fd2.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 120
          }
        },
        {
          "Key": "60x60",
          "Value": {
            "Height": 60,
            "Name": "j6588_74625_8c7d09462a0599543191b7844dec6fd2.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 60
          }
        }
      ],
      [
        {
          "Key": "RAW",
          "Value": {
            "Height": 0,
            "Name": "j6588_74623_6a65b7a337940d5e3fba66032ebc048b.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 0
          }
        },
        {
          "Key": "480x360",
          "Value": {
            "Height": 360,
            "Name": "j6588_74623_6a65b7a337940d5e3fba66032ebc048b.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 480
          }
        },
        {
          "Key": "240x180",
          "Value": {
            "Height": 180,
            "Name": "j6588_74623_6a65b7a337940d5e3fba66032ebc048b.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 240
          }
        },
        {
          "Key": "120x120",
          "Value": {
            "Height": 120,
            "Name": "j6588_74623_6a65b7a337940d5e3fba66032ebc048b.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 120
          }
        },
        {
          "Key": "60x60",
          "Value": {
            "Height": 60,
            "Name": "j6588_74623_6a65b7a337940d5e3fba66032ebc048b.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 60
          }
        }
      ],
      [
        {
          "Key": "RAW",
          "Value": {
            "Height": 0,
            "Name": "j6588_74621_57fe655e6ee57c403ed6cb0b6f1ddd39.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 0
          }
        },
        {
          "Key": "480x360",
          "Value": {
            "Height": 360,
            "Name": "j6588_74621_57fe655e6ee57c403ed6cb0b6f1ddd39.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 480
          }
        },
        {
          "Key": "240x180",
          "Value": {
            "Height": 180,
            "Name": "j6588_74621_57fe655e6ee57c403ed6cb0b6f1ddd39.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 240
          }
        },
        {
          "Key": "120x120",
          "Value": {
            "Height": 120,
            "Name": "j6588_74621_57fe655e6ee57c403ed6cb0b6f1ddd39.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 120
          }
        },
        {
          "Key": "60x60",
          "Value": {
            "Height": 60,
            "Name": "j6588_74621_57fe655e6ee57c403ed6cb0b6f1ddd39.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 60
          }
        }
      ],
      [
        {
          "Key": "RAW",
          "Value": {
            "Height": 0,
            "Name": "j6588_74619_b391251740cd7a8effbe66ffee73aeca.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 0
          }
        },
        {
          "Key": "480x360",
          "Value": {
            "Height": 360,
            "Name": "j6588_74619_b391251740cd7a8effbe66ffee73aeca.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 480
          }
        },
        {
          "Key": "240x180",
          "Value": {
            "Height": 180,
            "Name": "j6588_74619_b391251740cd7a8effbe66ffee73aeca.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 240
          }
        },
        {
          "Key": "120x120",
          "Value": {
            "Height": 120,
            "Name": "j6588_74619_b391251740cd7a8effbe66ffee73aeca.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 120
          }
        },
        {
          "Key": "60x60",
          "Value": {
            "Height": 60,
            "Name": "j6588_74619_b391251740cd7a8effbe66ffee73aeca.jpg",
            "TimeStamp": "201507021418",
            "Type": 1,
            "Width": 60
          }
        }
      ],
      
    ]}</list>
Posted
Updated 13-Jul-15 0:47am
v2

1 solution

Along with that RootObject, you need the below code to deserialize.
C#
using System.Web.Script.Serialization;

JavaScriptSerializer oJS = new JavaScriptSerializer();
RootObject oRootObject = new RootObject();
oRootObject = oJS.Deserialize<RootObject>(Your JSon String);
 
Share this answer
 
Comments
ct_12 13-Jul-15 7:06am    
Tadit Dash , this is the problem. if you look at the RootObject you will see public List<list><>> ImageList { get; set; } it means there is no Object within the List< > .
Try with...

public List<Image> ImageList { get; set; }

Make another class for Image with properties like Key and Value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900