allow json encoder to be overwritten

Useful if you want to add some custom jackson serializers for encoding stuff.