fiftyone.core.json¶
FiftyOne JSON handling
Classes:
|
JSON encoder for FiftyOne network comms. |
Functions:
|
Converts unsafe JSON types to strings |
-
fiftyone.core.json.
stringify
(d, _cls=None)¶ Converts unsafe JSON types to strings
- Parameters
d – serializable data
- Returns
a stringified version of the data
-
class
fiftyone.core.json.
FiftyOneJSONEncoder
(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)¶ Bases:
json.encoder.JSONEncoder
JSON encoder for FiftyOne network comms.
Any classes with non-standard serialization methods should be accounted for in the default() method.
Methods:
default
(o)Returns the serialized representation of the objects
dumps
(data, *args, **kwargs)encode
(o)Return a JSON string representation of a Python data structure.
iterencode
(o[, _one_shot])Encode the given object and yield each string representation as available.
loads
(*args, **kwargs)process
(data, *args, **kwargs)Attributes:
-
default
(o)¶ Returns the serialized representation of the objects
- Parameters
o – the object
- Returns
str
-
static
dumps
(data, *args, **kwargs) → str¶
-
static
loads
(*args, **kwargs) → dict¶
-
static
process
(data, *args, **kwargs)¶
-
encode
(o)¶ Return a JSON string representation of a Python data structure.
>>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}'
-
item_separator
= ', '¶
-
iterencode
(o, _one_shot=False)¶ Encode the given object and yield each string representation as available.
For example:
for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk)
-
key_separator
= ': '¶
-