Base OFM JSON encoder on LabThings encoder
This commit is contained in:
parent
3c27b5a6e6
commit
abd291f1e0
1 changed files with 4 additions and 2 deletions
|
|
@ -8,6 +8,8 @@ from uuid import UUID
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
|
|
||||||
|
from labthings.server.representations import LabThingsJSONEncoder
|
||||||
|
|
||||||
from .paths import (
|
from .paths import (
|
||||||
SETTINGS_FILE_PATH,
|
SETTINGS_FILE_PATH,
|
||||||
DEFAULT_SETTINGS_FILE_PATH,
|
DEFAULT_SETTINGS_FILE_PATH,
|
||||||
|
|
@ -77,7 +79,7 @@ class OpenflexureSettingsFile:
|
||||||
return settings
|
return settings
|
||||||
|
|
||||||
|
|
||||||
class JSONEncoder(flask.json.JSONEncoder):
|
class JSONEncoder(LabThingsJSONEncoder):
|
||||||
"""
|
"""
|
||||||
A custom JSON encoder, with type conversions for PiCamera fractions, Numpy integers, and Numpy arrays
|
A custom JSON encoder, with type conversions for PiCamera fractions, Numpy integers, and Numpy arrays
|
||||||
"""
|
"""
|
||||||
|
|
@ -100,7 +102,7 @@ class JSONEncoder(flask.json.JSONEncoder):
|
||||||
else:
|
else:
|
||||||
# call base class implementation which takes care of
|
# call base class implementation which takes care of
|
||||||
# raising exceptions for unsupported types
|
# raising exceptions for unsupported types
|
||||||
return flask.json.JSONEncoder.default(self, o)
|
return LabThingsJSONEncoder.default(self, o)
|
||||||
|
|
||||||
|
|
||||||
# HANDLE BASIC LOADING AND SAVING OF SETTINGS FILES
|
# HANDLE BASIC LOADING AND SAVING OF SETTINGS FILES
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue