Skip to content

Commit

Permalink
feat: clean more key types
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfaircloth committed Sep 25, 2023
1 parent 3ca5b40 commit 74ce835
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions microsoft_azure_eventhub_source/_CleanEvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ def CleanEvent(source_dict: dict):
if value.endswith("\n"):
value = value.strip("\n")

try:
value = orjson.loads(value)
CleanEvent(value)
source_dict[key] = value
except orjson.JSONDecodeError:
pass
if value.startswith('{"') or value.startswith("[{"):
try:
value = orjson.loads(value)
CleanEvent(value)
source_dict[key] = value
except orjson.JSONDecodeError:
pass
elif isinstance(value, dict) and not value:
del source_dict[key]
elif isinstance(value, dict):
Expand Down

0 comments on commit 74ce835

Please sign in to comment.