What would be the best way to generate the json below using a .net web service? I plan to call this though jquery on the front end.
I’m not seeing if I have to piece it together by hand or if there’s an object structure in C# I could use that would equate to this when returned.
{'Option 1': {'Suboption':2},'Option 2': {'Suboption 2': {'Subsub 1':5, 'Subsub 2':6}}}
Right now I have the data formatted like this
Id | Text | ParentId
1 Option1 null
2 SubOption 1
3 Option2 null
4 SubOption2 3
5 SubSub1 4
6 SubSub2 4
But I can change the data structure if it would make it easier to generate the json.
EDIT
Final solution is loop with string builder to form up the JSON.
Thanks!
You need a recursive data structure to support the nesting.