Skip to content

Commit

Permalink
added comment to json converter
Browse files Browse the repository at this point in the history
  • Loading branch information
Gad committed Dec 25, 2024
1 parent 23e1fbb commit 25b4089
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/markitdown/_markitdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,14 +1206,21 @@ def convert(


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)
Expand Down

0 comments on commit 25b4089

Please sign in to comment.