0
How to format an array like this...
[
{name: "city", value: "sao-paulo-sp"},
{name: "types-properties", value: "apartamento"},
{name: "types-properties", value: "casa"}
]
to arrive at this result.
[
{name: "city", value: "sao-paulo-sp"},
{name: "types-properties", value: "apartamento,casa"}
]
This data is pulled from a form and formatted with .serializeArray()
At first, I thought I’d make a .map()
, compare the key and if it existed in the array I gave a .push()
, add the values with a comma.
I tested it this way here, but the URL is empty or null, so no list.