fixed json removal function for arrays