Flatting An object and Array Using Recursion and other Methods