See also this discourse thread, which discussed conversion to a NamedTuple and also recommended a generated function.
NamedTuple