Support circular reference for traces- improved ko.ToJSON with a custom replacer