Add json_encoder to json_encode.

It allows to write and append custom JSONEncoders.