<｜begin▁of▁sentence｜>### Instruction:
Given an oriented tree with edges [(1, 2), (1, 3), (2, 4), (2, 5), (3, 6), (3, 7)], can you generate a JSON-serializable dictionary that represents this tree structure, using NetworkX's tree_data function, with node 1 as the root?
### Response:
import networkx as nx
from networkx.readwrite import json_graph

# Create a directed graph (oriented tree)
G = nx.DiGraph()
G.add_edges_from([(1, 2), (1, 3), (2, 4), (2, 5), (3, 6), (3, 7)])

# Define the root of the tree
root = 1

# Generate tree data in a format suitable for JSON serialization
# specifying the identifiers for nodes and children
data = json_graph.tree_data(G, root=root, ident='id', children='children')

# Serialize the tree data using json
import json
serialized_data = json.dumps(data)

# Output results
print(serialized_data)
<|EOT|>
