| ■No91111 (れい さん) に返信 > 現在このようなものがあります。↓ > > result = 省略 > > var resultList = result.ToList(); > if (resultList.Count() == 0) > { > return NotFound(); > } > List<Dictionary<string, string>> ListA = new List<Dictionary<string, string>>(); > > foreach (var list in resultList) > { > Dictionary<string, string> diclist = new Dictionary<string, string>(); > diclist.Add("cd", list.cd); > diclist.Add("name", list.nm); > ListA.Add(diclist); > } > 上記の格納イメージは下記になると思います。 > ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー > ListA:[ > {cd: '001', name: '名前'} > ] > > ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー > > > > 下記を実現したい場合はどうロジックを組めばよいでしょうか? > ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー > CorprankList:[ > { > cd:001, > LisAt:[ > {cd: '001', name: '名前'} > ] > }, > { > Cd:002, > ListA:[ > {cd: '002', name: '名前'} > ] > }, > ] > ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー |