The afilter does not seem to work as described. Even using the example from the documentation does not work:
test.py
import dpath
import json
x = {
"a": {
"b": {
"3": 2,
"43": 30,
"c": "Waffles",
"d": "Waffles",
"e": {
"f": {
"g": "Roffle"
}
}
}
}
}
def afilter(x):
if "ffle" in str(x):
return True
return False
result = dpath.search(x, '**', afilter=afilter)
print(json.dumps(result, indent=4, sort_keys=True))
Output
{
"a": {
"b": {
"3": 2,
"43": 30,
"c": "Waffles",
"d": "Waffles",
"e": {
"f": {
"g": "Roffle"
}
}
}
}
}
It seems to be outputting ALL keys.
The
afilterdoes not seem to work as described. Even using the example from the documentation does not work:test.py
Output
{ "a": { "b": { "3": 2, "43": 30, "c": "Waffles", "d": "Waffles", "e": { "f": { "g": "Roffle" } } } } }It seems to be outputting ALL keys.