diff options
author | Frederick Muriuki Muriithi | 2023-07-17 09:49:51 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-07-17 09:49:51 +0300 |
commit | 8c4cd623c275f4903caa4caf2cbd8f7d207529d3 (patch) | |
tree | dad301f7c7dc9078b4776a9a72d3f496eab71aec /wqflask | |
parent | 79351f7f2750cbfe44ee868aee46ad0acfde5afe (diff) | |
download | genenetwork2-8c4cd623c275f4903caa4caf2cbd8f7d207529d3.tar.gz |
Serialize to JSON with custom encoder
Serialize values to JSON using the custom encoder that is aware of
data types the default encoder might not be aware of.
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/metadata_edits.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index 226a4b97..008489ce 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -382,7 +382,7 @@ View the diffs <a href='{url}' target='_blank'>here</a>", "success") data=MetadataAudit( dataset_id=name, editor=author, - json_data=json.dumps(diff_data), + json_data=json.dumps(diff_data, cls=CustomJSONEncoder), ), ) conn.commit() @@ -468,7 +468,7 @@ def update_probeset(name: str): data=MetadataAudit( dataset_id=data_.get("id"), editor=author, - json_data=json.dumps(diff_data), + json_data=json.dumps(diff_data, cls=CustomJSONEncoder), ), ) conn.commit() @@ -785,7 +785,7 @@ def approve_data(resource_id: str, file_name: str): data=MetadataAudit( dataset_id=sample_data.get("trait_name"), editor=sample_data.get("author"), - json_data=json.dumps(sample_data), + json_data=json.dumps(sample_data, cls=CustomJSONEncoder), ), ) # Once data is approved, rename it! |