Arrays output is missing double quotes

I’ve been sending data to an API and most of it works. I do have an issue which i’m unable to get my head around.

I’ve set my bundles to an array, i’ve mapped that variables of that array to a variable.

That variable is mentioned and works, but is missing “” to separate te items.

This is the input:

[
    {
        "keywords": [
            "milieu-investeringsaftrek",
            "MIA ",
            "non-firm ATO",
            "subsidieregeling Schoon en Emissieloos Bouwmaterieel"
        ]
    }
]

But then it makes this input in the HTTP request:

"data": "[{\"keywords\":[\"milieu-investeringsaftrek, MIA , non-firm ATO, subsidieregeling Schoon en Emissieloos Bouwmaterieel"], \"location_code\":2528}]",

I’d like it to be:

"data": "[{\"keywords\":[\"milieu-investeringsaftrek\", \"MIA \", \"non-firm ATO\", \"subsidieregeling Schoon en Emissieloos Bouwmaterieel"], \"location_code\":2528}]",

But i’m a bit lost on how to fix this, and my searches aren’t for the right terms, since i can’t find anything that really relates. I’m sorry for the n00bish question.

Welcome to the Make community!

You’ll just need to use one more function, join, to combine the array of values with ","

So the output of the map function is inserted into the first parameter of the join function, and then "," goes into the second parameter.

You can even delete the set variable module and put this directly in the HTTP module.

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

2 Likes

Excellent!

[{"keywords":["{{join(map(10.array; "Keyword"); """,""")}}"], "location_code":2528}]

Did the trick!