I have a challenge of creating nested objects from arrays of strings to store the sequence of input strings. Originally, I was only generating chains with a depth of 2, but now I need to expand this capability to create higher-depth chains.
Essentially, I am looking to transform an array like this:
["test1", "test2", "test3", "test4"]
into the following format:
{
"test1":
{
"test2":
{
"test3":
{
"test4": {}
}
}
}
}