dicogis.export.to_json module¶
JSON serializer.
- class dicogis.export.to_json.MetadatasetSerializerJson(flavor='dicogis', localized_strings=None, output_path=None, opt_size_prettify=True)¶
Bases:
MetadatasetSerializerBase
Export to JSON.
- __init__(flavor='dicogis', localized_strings=None, output_path=None, opt_size_prettify=True)¶
Store metadata into JSON files.
- as_udata(metadataset)¶
Serialize metadaset in a data structure matching udata dataset schema.
- Parameters:
metadataset (
MetaDataset
) – input metadataset to serialize- Return type:
- Returns:
serialized as dict
- json_encoder_for_unsupported_types(obj_to_encode)¶
Encode objects which are not serializable as they are by json.dump. Typically: pathlib.Path.
- serialize_metadaset(metadataset)¶
Serialize input metadataset as JSON file stored in output_path.
- Parameters:
metadataset (
MetaDataset
) – metadataset to serialize- Return type:
- Returns:
path to the generated JSON file