Add support for replacer function on JSON serialization