Usage of lightning:tree

In this blog, I am going to show how to use the lightning:tree component. In this example, I am fetching the data from the account and contact and opportunity object and show the data as a tree. A lightning:tree component displays the visualization of a structural hierarchy, such as a sitemap for a website or a role hierarchy in an organization. Items are displayed as hyperlinks and items in the hierarchy can be nested. Items with nested items are also known as branches.

Apex Class 

Lightning Component

Here is the output