tree2json: Add commit on detecting depth