I would like to recursively clean any fields which are undefined, or have an empty object as parent like this following:
Example:
{
  "a": {
    "b": {
      "c": undefined,
    }
  },
  "d": undefined,
  "e": {
    f: undefined,
  },
  "g": {
     "h": 'I',
     "j": undefined,
  },
  "k": "L",
  "m": {
     "n": {
       "o": {
         "z": undefined,
       }
     },
    "p": 'toto'
   }
}
I am expecting the following result :
{
  "g": {
    "h": 'I',
  },
  "k": 'L',
  "m": {
    "p": 'toto'
  }
}
Thank you for your help
 
     
     
    