Allow to pass custom kwargs to json.dumps

Thanks to Serghei Mihai <smihai@entrouvert.com>
for providing patch and detailed description