Json Writer
This ConfigWriter adds Json export and import support.
Module
- class comprehensiveconfig.json.JsonWriter
- classmethod dumps(cls, node) str
- Parameters:
node (AnyConfigField) – The configuration object we are writing.
Dumps a string output from a given config
- classmethod dump(cls, file, node) str
- Parameters:
file – The file name or object we are writing to.
node (AnyConfigField) – The configuration object we are writing.
Dumps a to a configuration section to a given file
- classmethod loads(cls, data: str)
- Parameters:
data (str) – The configuration object we are writing.
Load the given configuration string as
- classmethod load(cls, file)
- Parameters:
file – The file name or object we are writing to.
Load a given file and create a configuration object
Private Methods
- classmethod dump_section(cls, node: spec.Section)
- Parameters:
node – The section we are dumping
dump a section into json format. Running through each k/v pair and ensuring properly json serializable.
- classmethod dump_value(cls, node: spec.AnyConfigField, value)
- Parameters:
node – The node of the value we are dumping
value – The value of the node we are dumping.
Dump a field value as json serializable object.