Fixed json encoder for objects not using pydantic
This commit is contained in:
parent
135b1bc220
commit
504e8c9d17
|
@ -1,4 +1,3 @@
|
||||||
import json
|
|
||||||
from typing import Any, Text, MutableMapping
|
from typing import Any, Text, MutableMapping
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
@ -33,7 +32,7 @@ class ObjectParser:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def to_json(cls, obj: BaseObject) -> Text:
|
def to_json(cls, obj: BaseObject) -> Text:
|
||||||
return json.dumps(cls.to_dict(obj))
|
return obj.json()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_toml(cls, serialized: Text) -> BaseObject:
|
def from_toml(cls, serialized: Text) -> BaseObject:
|
||||||
|
|
Reference in New Issue