Add support for custom JSON encoding and decoding.