json
autocorpus.ac_bioc.bioctable.json
¤
This module provides a custom JSON encoder for BioCTableCollection objects.
Classes¤
BioCTableJSON
¤
Utility class for serializing BioCTableCollection objects to JSON.
Functions¤
dump(obj, fp, **kwargs)
staticmethod
¤
Serialize a BioCTableCollection object to a JSON file-like object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
object The object to serialize. |
required | |
fp
|
file-like object The file-like object to write the JSON data to. |
required | |
**kwargs
|
dict
Additional keyword arguments to pass to |
{}
|
Source code in autocorpus/ac_bioc/bioctable/json.py
82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
dumps(obj, **kwargs)
staticmethod
¤
Serialize a BioCTableCollection object to a JSON-formatted string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
object The object to serialize. |
required | |
**kwargs
|
dict
Additional keyword arguments to pass to |
{}
|
Returns:
Type | Description |
---|---|
str A JSON-formatted string representation of the object. |
Source code in autocorpus/ac_bioc/bioctable/json.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
BioCTableJSONEncoder
¤
Bases: BioCJSONEncoder
Custom JSON encoder for objects with a to_dict
method.
This encoder extends the BioCJsonEncoder to handle objects that implement
a to_dict
method, converting them to a dictionary representation for JSON serialization.
Functions¤
default(o)
¤
Convert an object to a JSON-serializable dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
o
|
object The object to serialize. |
required |
Returns:
Type | Description |
---|---|
dict A dictionary representation of the object if it is serializable. |
Source code in autocorpus/ac_bioc/bioctable/json.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|