RUYSGXKQE4F7GWQ6OFI6DABOHVCNOGCYFTUQPK3XTPZ2UPGD4Y2QC % turn [A, B, C, D] into #{A => B, C => D}% TODO: i wonder if there is a more direct way for this conversion{Indexed,_} = lists:mapfoldl(fun(V, Acc) -> { {V, Acc}, Acc+1 } end, 0, KVs),Even = [ K || {K, I} <- Indexed, I rem 2 =:= 0],Odd = [ K || {K, I} <- Indexed, I rem 2 =:= 1],Infos = maps:from_list(lists:zip(Even, Odd)),proplists:delete(postBody, Header) ++ [ {infos, Infos}].
proplists:delete(postBody, Header) ++ [ {infos, list_to_map(KVs)}].
%%%% helpers% turn [A, B, C, D] into #{A => B, C => D}% thanks https://social.coop/@rogerlipscombe@hachyderm.io/111212196457684597 !list_to_map(Lst) -> list_to_map(Lst, #{}).list_to_map([K, V | Rest], Acc) ->list_to_map(Rest, Acc#{K => V});list_to_map([], Acc) -> Acc.