<｜begin▁of▁sentence｜>### Instruction:
Given a list of nodes each with an 'id' and 'label', and a list of edges each with a 'source', 'target', and 'label', how would you represent this graph as a JSON object?
### Response:
import json

# Define the nodes and edges of the graph
nodes = [{"id": "n1", "label": "Node 1"}, {"id": "n2", "label": "Node 2"}, {"id": "n3", "label": "Node 3"}]
edges = [{"source": "n1", "target": "n2", "label": "Edge from Node 1 to Node 2"}, {"source": "n2", "target": "n3", "label": "Edge from Node 2 to Node 3"}]

# Create the JSON object for the graph
graph_json = {"graph nodes": nodes, "graph edges": edges}

# Convert the graph JSON object to a JSON string
graph_json_str = json.dumps(graph_json, indent=2)

# Print the JSON string
print(graph_json_str)
<|EOT|>
