I have somethat that may look like the output of tree like command. I want it a plain list wihtout nesting for further processing. I want to convert the following on the left to the one on the right.

{
    "/opt": [
        "a",
        "b",
        "c",
    ],
    "/root": [
        "a",
        "b",
        "c",
    ],
}
[
    "/opt/a",
    "/opt/b",
    "/opt/c",
    "/root/a",
    "/root/b",
    "/root/c",
]

The following gist shows how to do it. You can play with code on the playground here https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=dfdbc1036a4bc502488598a742552fba.

Line 12 converts HashMap to a vector of vector where inner most vector is join of key with individual values. flatten converts vector of vector to a vector (akin to concat).

Gist

https://gist.github.com/rust-play/3a11b9e4d16e992e995c8aa0d26c6141