Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!