def decimal_default(obj):
    """JSON serialization of Decimal.

    *Usage:*
      ``json.dumps(data, default=decimal_default)``

    Converts decimal to string.

    """
    if obj.__class__.__name__ == 'Decimal':
        return str(obj)
    raise TypeError
