Possible duplicate:
Python JSON serialize decimal object
I have the following SQL:
SELECT concat(UNIX_TIMESTAMP(date), '000') as datetime, SUM(royalty_price) as sales FROM sales_raw GROUP BY datetime
The results look something like this:
datetime sales 1337151600000 1045.71 (decimal) 1337238000000 478.04 1337324400000 300.96 1337410800000 289.02
From this I get the following error:
Exception Type: TypeError at /ajax/graph/ Exception Value: Decimal('1045.71') is not JSON serializable
How to convert decimal to acceptable format in mysql to be able to serialize this data?
source share