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

171
Vistas
Converting to CSV results in [object,object]

I am trying to convert and then download an array of objects. my conversion looks like

const convertToCsv = (objects) => {
  var res = objects;
  var data = new Blob([res], { type: "text/csv" });
  var csvURL = URL.createObjectURL(data);
  return csvURL;
};

which results in a blob URL

and my data to download looks like this

[
    0: {sid: 31, name: "jkk", email: "kkjd@abc.com", updated_at: "2021-09-19T17:17:22.099363+00:00"}
    1: {sid: 32, name: "jak", email: "kkjd@abc.com", updated_at: "2021-09-19T17:17:22.099363+00:00"}
]

my download link looks like this

<a href={downloadArray.length ? convertToCsv(downloadArray) : null} target="_blank" download="filename.csv">
    download selected
</a>

my CSV file looks like this

[object Object] [object Object]

however, when I target only the email or name etc it downloads the data correctly. I know it will be something small that I am missing!

As always any help is greatly appreciated.

EDIT:

I have created a sandbox which reproduces the issue https://codesandbox.io/s/elastic-night-c98et?file=/src/App.js

about 4 years ago · Juan Pablo Isaza
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