serialize dict to a JSON formated string.

This commit is contained in:
Yoshihiro OKUMURA 2023-05-18 11:45:18 +09:00
parent d983c452de
commit 837f035bc1
Signed by: orrisroot
GPG Key ID: 470AA444C92904B2
2 changed files with 4 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import json
import os import os
from argparse import Namespace, _SubParsersAction from argparse import Namespace, _SubParsersAction
@ -28,4 +29,4 @@ class FileMetadataCommand(BaseCommand):
raise IllegalArgumentException(f"File `{r_basename}` not found.") raise IllegalArgumentException(f"File `{r_basename}` not found.")
file_api = FileApi(connection) file_api = FileApi(connection)
metadata = file_api.metadata(file) metadata = file_api.metadata(file)
print(metadata) print(json.dumps(metadata))

View File

@ -1,3 +1,4 @@
import json
from argparse import Namespace, _SubParsersAction from argparse import Namespace, _SubParsersAction
from mdrsclient.api import FolderApi from mdrsclient.api import FolderApi
@ -20,4 +21,4 @@ class MetadataCommand(BaseCommand):
folder = self._find_folder(connection, laboratory, r_path, args.password) folder = self._find_folder(connection, laboratory, r_path, args.password)
folder_api = FolderApi(connection) folder_api = FolderApi(connection)
metadata = folder_api.metadata(folder.id) metadata = folder_api.metadata(folder.id)
print(metadata) print(json.dumps(metadata))