2.5.1.2. h5pywrappers.json.document.save

save(json_document, json_document_id, write_mode='w-')[source]

Save a JSON document to an HDF5 file.

A JSON document is a dictionary that can be directly serialized into the JSON format. JSON documents are stored as bytes objects or numpy bytes arrays in HDF5 files.

Parameters:
json_documentdict | h5py.Dataset

The JSON document of interest to save to an HDF5 file.

json_document_idh5pywrappers.obj.ID

The parameter set specifying where to save the JSON document of interest.

write_mode“w” | “w-” | “a” | “a-”, optional

The write mode upon opening the HDF5 file to which to save the HDF5 JSON document of interest: if write_mode is set to "w", then the target HDF5 file is emptied prior to saving the HDF5 JSON document of interest; else if write_mode is set to "w-", then the HDF5 JSON document of interest is saved unless a file already exists with the target filename, in which case an error is raised and the target HDF5 file is left unmodified; else if write_mode is set to "a-", then the HDF5 JSON document of interest is saved unless an HDF5 object already exists at the target HDF5 path of the target HDF5 file, in which case an error is raised and the target HDF5 file is left unmodified; else if write_mode is set to "a", then the HDF5 JSON document of interest is saved without emptying the target HDF5 file, replacing any HDF5 object at the target HDF5 path should one exist prior to saving.

Returns: