in reply to iterating through json decode
Your repl_mongo looks to be a reinvention of Data::Leaf::Walker->each(). It might be simpler just to use that instead?