Skip to content
Snippets Groups Projects
core.py 296 B
Newer Older
  • Learn to ignore specific revisions
  • # -*- coding: utf-8 -*-
    
    import json
    from decimal import Decimal
    
    
    # Custom JSON Encoder for Decimal
    class DecimalEncoder(json.JSONEncoder):
        def default(self, obj):
            if isinstance(obj, Decimal):
                return float(obj)
            return super(DecimalEncoder, self).default(obj)