nested tree to_jason