Added tree building from JSON