From 25b40899176985328088284939a8dc0cdf872983 Mon Sep 17 00:00:00 2001 From: Certainly Not a Genius Date: Wed, 25 Dec 2024 21:58:02 +0100 Subject: [PATCH] added comment to json converter --- src/markitdown/_markitdown.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/markitdown/_markitdown.py b/src/markitdown/_markitdown.py index 1e6e83e..00104be 100644 --- a/src/markitdown/_markitdown.py +++ b/src/markitdown/_markitdown.py @@ -1206,14 +1206,21 @@ class ZipConverter(DocumentConverter): class JsonConverter(DocumentConverter): + """Converts generic json files to markdown : + - keys are prefixed with the whole dictionnary tree starting with the file name + - values are kept untouched + - key/values are between backtips + - (ordered) lists are converted into markdown ordered lists starting at 0.""" + def convert( self, local_path: str, **kwargs: Any ) -> Union[None, DocumentConverterResult]: - # Bail if not an image extension = kwargs.get("file_extension", "") if extension.lower() not in [".json"]: return None + # TODO : check similar extensions and/or mime type + with open(local_path) as test_json: try: json_data = json.load(test_json)