<｜begin▁of▁sentence｜>### Instruction:
Given the coappearance network of characters in the novel Les Miserables, how can you create and print a JSON representation of the graph nodes and edges where each node has an 'id' and 'label', and each edge has a 'source', 'target', and 'label'?
### Response:
import networkx as nx

# Load the Les Miserables graph
G = nx.les_miserables_graph()

# Prepare data for JSON
nodes_data = [{'id': node, 'label': data['label']} for node, data in G.nodes(data=True)]
edges_data = [{'source': u, 'target': v, 'label': f'{u}-{v}'} for u, v in G.edges()]

# Generate JSON
les_miserables_json = {
    'graph nodes': nodes_data,
    'graph edges': edges_data
}

print(les_miserables_json)
<|EOT|>
