Create a nested json object from another nested json object : As the question states, I want to create a new object from a current json object. 

My current json object: 

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

    {
      "name": "Parent",
      "children": [
          {
              "name": "Child1",
              "children": [
                  {
                      "name": "GrandChid1",
                      "children": []
                  },
                  {
                      "name": "GrandChild2",
                      "children": []
                  },
                  {
                      "name": "GrandChild3",
                      "children": [
                          {
                              "name": "GrandGrandChild1",
                              "children": [
                                  {
                                      "name": "GrandGrandGrandChild1",
                                      "children": []
                                  },
                                  {
                                      "name": "GrandGrandGrandChild2",
                                      "children": []
                                  }
                              ]
                          }
                      ]
                  }
              ]
          }
      ]
    }

<!-- end snippet -->

Now the new object will look something like this:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

    {
      "Parent": [
          {
              "name": "Child1",
              "Child1": [
                  {
                      "GrandChid1": ''
                  },
                  {
                      "GrandChild2": ''
                  },
                  {
                      "GrandChild3": [
                          {
                              "GrandGrandChild1": [
                                  {
                                      "GrandGrandGrandChild1": ''
                                  },
                                  {
                                      "GrandGrandGrandChild2": ''
                                  }
                              ]
                          }
                      ]
                  }
              ]
          }
      ]
    }

<!-- end snippet -->

if there are no children then it becomes a string (simple key value) pair.
Any help is appreciated especially with a recursive solution