allow additional options to be passed to the JSON backend

This builds on top of #2 to allow customizing the behaviour of the JSON
serializer - e.g. changing the options for utf8, ascii, pretty, allow_nonref,
etc.