Encode decimals as number in JSON
This commit is contained in:
parent
e7e7179cd9
commit
3f130363d7
6 changed files with 36 additions and 1 deletions
|
@ -5,6 +5,8 @@ from typing import Optional
|
|||
from uuid import UUID
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.util.encoders import decimal_encoder
|
||||
|
||||
class PhaseType(enum.Enum):
|
||||
L1 = "L1"
|
||||
L2 = "L2"
|
||||
|
@ -55,3 +57,4 @@ class MeterValue(BaseModel):
|
|||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
json_encoders = {Decimal: decimal_encoder}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue