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 2a95d86 commit 4d20141
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions microsoft_azure_eventhub_source/_CleanEvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ def CleanEvent(source_dict: dict):
if value.endswith("\n"):
value = value.strip("\n")

if value.startswith('{"'):
try:
value = orjson.loads(value)
CleanEvent(value)
source_dict[key] = value
except orjson.JSONDecodeError:
pass
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 4d20141

Please sign in to comment.