added comment to json converter
This commit is contained in:
parent
23e1fbb064
commit
25b4089917
1 changed files with 8 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue