Allow use of custom json handler to encode PUT request data

Python's json module can't encode some objects in its default implementation, such as datetime objects. This change allows the user to supply their own custom handler for these cases.