The only experience I have with Json so far is for the most part the out-of-the-box wrappers, so please bear with me... So, I have a FlowDocument which has text. Inside the text words can be Hyperlinks. These Hyperlinks point to objects it represents. As a short example:
“My dog is very sweet.”
in this example dog is a hyperlink pointing to a Dog class with some basic fields, for instance:
name: Fido
owner: me
isGoodBoy: yes
behind the scenes this coupling is done through a Dictionairy<Hyperlink, Dog>
Now I want to serialize this construction without losing the hirarchy / references Since the document has references to the Dict, I need to serialize that first. When I perserve reference handling out of the box on this bird's eye view level I get:
{
"$id": "1",
{
“dog” : { “name” : “Fido”,“owner”: “me”,“isGoodBoy”: “yes”},
}
}
and: "$id": "2" on the SerializedFlowDocument
Serializing the document itself is not a problem as I don't need to serialize any mark-up, simplified, I can grab the string from each run and put them in an array. I'd end up with something like
serializedDoc[0] =“My ”
serializedDoc[1] =”dog”
serializedDoc[2] =“ is very sweet.”
However dog was a hyperlink, so I'd rather see serializedDoc[1] = "$ref": "1" Which brings me back to the Dict. Is there a way to specify that I want a reference to the Key in the k/v-pair instead of the whole Dict? Something in the lines of this:
{
{
“dog”
"$id": "1": { “name” : “Fido”,“owner” : “me”,“isGoodBoy” : “yes”},
}
}