def default(self, o):
if isinstance(o, decimal.Decimal):<EOL><INDENT>return float(o)<EOL><DEDENT>if isinstance(o, (datetime.datetime, datetime.date)):<EOL><INDENT>return o.isoformat()<EOL><DEDENT>return json.JSONEncoder.default(self, o)<EOL>
Encode JSON.

        :return str: A JSON encoded string