File: thorn.py

package info (click to toggle)
python-sdjson 0.5.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 560 kB
  • sloc: python: 1,566; makefile: 6; sh: 6
file content (11 lines) | stat: -rw-r--r-- 208 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
# stdlib
from decimal import Decimal

# this package
import sdjson


# Create a custom encoder for Decimal that turns it into a string
@sdjson.encoders.register(Decimal)
def encode_str(obj):
	return str(obj)