I have dictionary in below format and would like to check if we have any existing methos that can reorder dictionary if we provide the array with the key names in desired order?
I would like to see my final dictionary in below order of key along with their values.
desired_order = [“date”, “time”, “field2”, “field1”, “field3”, “field4”, “field5”, “field6”, “field7”]
[Dict{String, Any}("field1" => 26, "field2" => 1, "time" => "14:00", "field3" => 0, "date" => "2024-03-09", "field4" => 102, "field5" => 17, "field6" => 10, "field7" => 97), Dict{String, Any}("field1" => 1, "field2" => 1, "time" => "04:00", "field3" => 0, "date" => "2024-03-09", "field4" => 6, "field5" => 0, "field6" => 2, "field7" => 5), Dict{String, Any}("field1" => 18, "field2" => 1, "time" => "17:45", "field3" => 7, "date" => "2024-03-07", "field4" => 101, "field5" => 9, "field6" => 10, "field7" => 114), Dict{String, Any}("field1" => 0, "field2" => 0, "time" => "06:00", "field3" => 0, "date" => "2024-03-10", "field4" => 26, "field5" => 5, "field6" => 5, "field7" => 46)]