Extracting all keys of a dictionary at a certain level to an array (or simmilar collection)

Hi there,

I have a dictionary like the following:

e = (a: (aa: (aa1: 1, aa2: 1, aa3: 1)), b: (bb: (bb1: 1, bb2: 1, bb3: 1)))

Now I would like to extract all keys of the innermost dictionaries (level 2) to one array (or a list). I found this approach which seems to to what it should:

a = [];
e.deepCollect(2, { |k| a = a ++ k.keys });
a.postln; // -> [aa1, aa2, aa3, bb2, bb1, bb3]

I wondering, is there maybe a more elegant, more “idiomatic” way to solve this problem?

Thanks, Stefan