Alexander Mills
Alexander Mills

Reputation: 100200

Override the JSON stringify method in process.send()

I am calling process.send(val) with an IPC message between parent and child. The object val has some arbitrary circular references, that are hard to prune, reliably. I have a custom JSON stringify function that can handle circular refs. Is there a way to override the JSON.stringify method within process.send()?

Something like:

const serializableObj = {
  [process.send.stringify](){
      return myCustomStringify(this);
  }
}

Upvotes: 0

Views: 127

Answers (0)

Related Questions