Return value of util.serialize(dagNode.toJSON()) should produce equal value to `dagNode.serialize()`
Current implementation of .toJSON() produces structure with fields: data, links and size. Which somewhat resembles DAGNode however passing that value into ipld.put stores block with CID QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n corresponding to {} because call to util.serialize looks at the capital cased fields instead
https://github.com/ipld/js-ipld-dag-pb/blob/1012cad04bd48183caf901c91ede1c9da67d0751/src/serialize.js#L40-L50
Which I find really unfortunate, as I was hoping to toJSON() for posting nodes across the threads.
For my specific use case it would be even better if Data and Links getters were just turned into regular properties. That would make it unnecessary to call toJSON at least for my use case.
toJSON() is mostly there for test purpose. It shouldn't really be used. I would've long removed it (as in other codec implementations) if it wouldn't break so much.