tree:

length(tree)

Returns the number of objects in the given tree.

$ ori capitals.yaml
Japan: Tokyo
Turkey: Ankara
Australia: Canberra
Spain: Madrid
$ ori length capitals.yaml
4