<｜begin▁of▁sentence｜>### Instruction:
As a Computer Systems Analyst, you're tasked with optimizing the way a hierarchical organization chart, currently represented as a directed tree with linkages between roles defined by the edge set [(1, 2), (1, 3), (2, 4), (3, 5)], is processed and shared across different systems. The objective is to transform this structure into a format that's digestible by our web-based interface tools. This requires converting the tree into a JSON serializable dictionary that outlines the relationships between nodes and links, with the role at position 1 serving as the overarching 'root' of the organization. Could you devise an approach using NetworkX to effectively carry out this conversion, ensuring the result is seamlessly integrable into a JavaScript-driven dashboard for real-time visualization?
### Response:
import networkx as nx
from networkx.readwrite import json_graph

# Create an oriented tree
G = nx.DiGraph()
G.add_edges_from([(1, 2), (1, 3), (2, 4), (3, 5)])

# Use the `tree_data` function to generate the tree data
root_node = 1
tree_json_data = json_graph.tree_data(G, root=root_node)

print(tree_json_data)
<|EOT|>
