Accept arguments from JSON encoding method.

This passes them onto Python built-in JSON encoding library. Also included the
same fix for Tornado's JSON decoding method.