Considering we have:
acs = <|"A" -> <|"a" -> " ", "aa" -> "asd"|>, "B" -> <|"bb" -> " "|>|>
How can we come to have a result as:
res = <|"A" -> <| "aa" -> "asd"|>|>
Thanks!
DeleteCases[Association@KeyValueMap[#1->DeleteCases[#2,_?(StringMatchQ[ToString@#,Whitespace..]&)]&,acs],_?(#==<||>&)]
Here is a solution, based on pattern matching in the list of rules of the association:
acs //. x_Association :> Normal[x]
DeleteCases[ %, (key_->val_String) /; StringMatchQ[val, " "..], Infinity]
DeleteCases[ %, _->{}]
% /. List->Association
(*
{A->{a-> ,aa->asd},B->{bb-> }}
{A->{aa->asd},B->{}}
{A->{aa->asd}}
<|A-><|aa->asd|>|>
*)