somewhat naive way of handling circular dependencies when printing json objects