GeoJson data to nested object with children

Avatar

Does anyone have a good solution for transforming geojson data with parents array to nested object with children? This would be the final format:

{

  "id": {

     ...properties,

     children: {

       "id":{ ... },

       "id": { ... },

       ....

     }

   }

}