How to post a list in a external API?

Hello,

I need to send emails to some specific users using SendGrid. I have a list of emails, and I need to input a list into an external API.

e.g.:

{"to": [
        {"email": "[email protected]"},
        {"email": "[email protected]"}
       ]
}

How do I convert this list of emails into this object input?

Thank you!





2 replies