def print_mongo_paths(json_object, current_path=""):
if isinstance(json_object, dict):
for key, value in json_object.items():
new_path = f"{current_path}.{key}" if current_path else key
print_mongo_paths(value, new_path)
elif isinstance(json_object, list):
for i, item in enumerate(json_object):
new_path = f"{current_path}.{i}" if current_path else str(i)
print_mongo_paths(item, new_path)
else:
print(current_path)
# Example JSON object
example_json = {
"file": [
{
"extraction": {
"signature": {
"extraction": [
{
"signature": {
"extraction": {
"normalized_value": "example_value"
}
}
}
]
}
}
}
]
}
# Print paths in MongoDB query format
print_mongo_paths(example_json)