I need to delimite and categorize below json value
for ex : "sub3[+]888800"
sub3
is category code and 888800
is element of category.
["sub3[+]888800","sub3[+]100000","06[+]888800","06[+]100000"]
i need to result like that
sub3 -> 888800, 100000 06 - > 888800, 100000
- List<string> seledItems = this.ResetSeledItems();
- this.litDebug.Text = Newtonsoft.Json.JsonConvert.SerializeObject(seledItems);
- var json = this.litDebug.Text;
- var strs = JArray.Parse(json);
-
-
- var items =
- from str in strs.Select(x => (string)x)
- let idx = str.IndexOf("[+]")
- select new
- {
- tag = str.Substring(0, idx),
- data = str.Substring(idx + 3)
- };
-
- var grps =
- from item in items
- group item by item.tag into grp
- select new
- {
- tag = grp.Key,
- items = grp.Select(x => x.data)
- };
- foreach (var grp in grps)
- {
- string tag = grp.tag.ToString();
-
- for(int i=0;i<=grp.items.Count-1 ; i++) //grp.items.Count wrong.
- {
- string item = grp.items.ToString(); // not get the value.
- }
- }
how can i resolve this problem ?