The afilter does not seem to work as described. Even using the example from the documentation does not work:
test.py
importdpathimportjsonx= {
"a": {
"b": {
"3": 2,
"43": 30,
"c": "Waffles",
"d": "Waffles",
"e": {
"f": {
"g": "Roffle"
}
}
}
}
}
defafilter(x):
if"ffle"instr(x):
returnTruereturnFalseresult=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.