serialization¶
Helpers for JSON serialization of experiments.
ObjectJSONEncoder
¶
to_json
¶
Serialize to JSON.
The object is encoded before the file is written, so a value which cannot be encoded leaves no truncated file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object
|
Any
|
the object to serialize. |
required |
path
|
Path | None
|
the file to write, |
None
|
Returns:
| Type | Description |
|---|---|
str | Path
|
The JSON, or the path of the file it was written to. |
Raises:
| Type | Description |
|---|---|
TypeError
|
for a value which |