I am looking for a solution to convert my list of fields, stored as a string, into a JSON object. The fields are listed as follows:
[
"Container.Description",
"Container.Groups.12.Users.11.Name",
"Container.Groups.12.Users.12.Name",
"Container.Groups.13.Users.21.Name",
"Container.Groups.13.Users.22.Name"
]
The desired output should be in the following JSON format:
{
"Container": {
"Description": "",
"Groups": [
{
"12": {
"Users": [
{ "11": { "Name": "" }},
{ "12": { "Name": "" }}
]
}
},
{
"13": {
"Users": [
{ "21": { "Name": "" }},
{ "22": { "Name": "" }}
]
}
}
]
}
}
If anyone can assist with converting this code into TypeScript or C#, I would greatly appreciate it. Thank you in advance!