Generate json file for tree