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

309
Vistas
Javascript: How to print object line by line?

In my React Native app I'm displaying modals that contain a printout of an object. I use the Alert.alert() method, which you need to pass a string to. Since I have an object I want to print, I pass JSON.stringify(obj) to the method. However, this prints the object like this:

{"prop1":"value1","prop2":"value2"}

Is there a way to print it like

{
  prop1: value1,
  prop2: value2
}

without looping through the keys of the object?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Run it in the console. It will copy it to your clipboard.

const beautifyJSON = JSON.stringify({"prop1":"value1","prop2":"value2"}, null, "\t");

You can read about stringify parameters here

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