Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

123
Vistas
Expecting a string but getting an array

I want to get an array which has objects that contains string, but I am only getting the array without objects or string

const emails = [
  {
    email: "dot@gmail.com",
  },
  {
    email: "ke@gmail.com",
  },
];

const msg = {

  personalizations: emails.map((email) => ({
    to: [{ email: email.email }],
    subject: "Hello World from the Personalization API!",
  })),

};

when i console log msg I get:

{
  personalizations: [
    {
      to: [Array],
      subject: 'Hello World from the Personalization API!'
    },
    {
      to: [Array],
      subject: 'Hello World from the Personalization API!'
    }
  ],
}

I want get the values of to when I console log like this:

  "personalizations": [
    {
      "to": [
        {
          "email": "john@example.com"
        }
      ],
      "send_at": 1600188812
    },
    {
      "to": [
        {
          "email": "jane@example.com"
        }
      ],
      "send_at": 1600275471
    }
  ]
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

As from the output. It's very easy to do. I believe all you need is JSON.stringify()
So: console.log(JSON.stringify(msg));, It should do the job.
Though, for making it readable, you need JSON Prettier

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda