I can easily come up with a data structure that would represent my document. You’re right, it’s exactly the parts that I’m serializing. It would look like this:
{
"camera": {
"x": 0,
"y": 0
},
"nodes": [
{
"id": 0,
"label": {
"radius": 60,
"heading": {
"text": "Test node 0"
},
"description": {
"text": "Some description"
}
}
},
{
"id": 1,
"label": {
"radius": 60,
"heading": {
"text": "Test node 1"
},
"description": {
"text": ""
}
}
},
{
"id": 2,
"label": {
"radius": 60,
"heading": {
"text": "Test node 2"
},
"description": {
"text": ""
}
}
},
{
"id": 3,
"label": {
"radius": 60,
"heading": {
"text": "Test node 3"
},
"description": {
"text": ""
}
}
},
{
"id": 4,
"label": {
"radius": 60,
"heading": {
"text": "Test node 4"
},
"description": {
"text": ""
}
}
},
{
"id": 5,
"label": {
"radius": 60,
"heading": {
"text": "Test node 5"
},
"description": {
"text": ""
}
}
}
],
"edges": [
{
"to": 4,
"from": 3,
"label": null
},
{
"to": 5,
"from": 2,
"label": null
},
{
"to": 4,
"from": 2,
"label": null
},
{
"to": 3,
"from": 2,
"label": null
},
{
"to": 2,
"from": 0,
"label": null
},
{
"to": 1,
"from": 0,
"label": null
}
]
}
But what then? Not to repeat myself: