public class B { public int areasysno { get; set; } public string areaname { get; set; } public int citysysno { get; set; } public string cityname { get; set; } public int provincesysno { get; set; } public string provincename { get; set; } public string T() { List<B> list = new List<B> { new B { areasysno=111,areaname="111a",citysysno=11,cityname="11a",provincesysno=1,provincename="a"}, new B { areasysno=112,areaname="112a",citysysno=11,cityname="11a",provincesysno=1,provincename="a"}, new B { areasysno=121,areaname="121a",citysysno=12,cityname="12a",provincesysno=1,provincename="a"}, new B { areasysno=122,areaname="121a",citysysno=12,cityname="12a",provincesysno=1,provincename="a"}, new B { areasysno=211,areaname="211b",citysysno=21,cityname="21b",provincesysno=2,provincename="b"}, new B { areasysno=221,areaname="221b",citysysno=22,cityname="22b",provincesysno=2,provincename="b"}, new B { areasysno=212,areaname="212b",citysysno=21,cityname="21b",provincesysno=2,provincename="b"}, }; var provinces = list.GroupBy(x => x.provincesysno).Select(x => new { provincesysno = x.Key, provincename = list.First(y => y.provincesysno == x.Key)?.provincename }); var citys = list.GroupBy(x => x.citysysno).Select(x => new { citysysno = x.Key, cityname = list.First(y => y.citysysno == x.Key)?.cityname,provincesysno= list.First(y => y.citysysno == x.Key)?.provincesysno }); var dic = provinces.ToDictionary(x => x.provincesysno, x => new { province = provincename, cityList = citys.Where(y => y.provincesysno == x.provincesysno).ToDictionary(z => z.citysysno, z => new { city = z.cityname, regionList = list.Where(a => a.citysysno == z.citysysno).ToDictionary(b => b.areasysno, b => new { area = b.areaname }) }) }); return JsonConvert.SerializeObject(dic); } }