Sometimes there is a need in creating a copy of JSON node subtree to another independent node to perform transformations. For this purpose it would be great to have a function to deep copy the whole data of one node to another node. There is a MutateToNode function which can do something familiar to copy, but it assigns pointers to nodes which can cause unplanned mutations. Also, when a node from one decoder is copied to a node from another via MutateToNode, if the fist node is released, its decoder is returned to pool and is prepared to be collected by GC, it might not be freed because the pointers to nodes from its pool are used in a node from another decoder and it can lead to memory leaks.
Sometimes there is a need in creating a copy of JSON node subtree to another independent node to perform transformations. For this purpose it would be great to have a function to deep copy the whole data of one node to another node. There is a
MutateToNodefunction which can do something familiar to copy, but it assigns pointers to nodes which can cause unplanned mutations. Also, when a node from one decoder is copied to a node from another viaMutateToNode, if the fist node is released, its decoder is returned to pool and is prepared to be collected by GC, it might not be freed because the pointers to nodes from its pool are used in a node from another decoder and it can lead to memory leaks.