Prevent infinite recursion formatting cyclicly nested arrays