Cleanup (triple-quote docstrings, whitespace, reformatting)
Added 'json_dumps' and 'json_loads' parameters to allow custom JSON serialization handling