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

157
Views
How can I return data from a MySQL query without it being [Object, object] and also, not a string via JSON.stringify?

I am getting the following results from SELECT query to a table in a MySQL db:

[
  RowDataPacket {
    id: 1,
    title: 'foo',
    date: 2012-07-06T08:40:14.000Z
  },
  RowDataPacket {
    id: 2,
    title: 'foo',
    date: 2021-12-16T16:00:12.000Z
  },
  RowDataPacket {
    id: 3,
    title: 'foo',
    date: 2012-07-06T08:40:14.000Z
  },
  RowDataPacket {
    id: 4,
    title: 'foo',
    date: 2019-12-02T14:13:41.000Z
  },
  RowDataPacket {
    id: 5,
    title: 'foo',
    date: 2019-11-25T12:46:25.000Z
  },
  RowDataPacket {
    id: 6,
    title: 'foo',
    date: 2021-12-17T16:00:12.000Z
  },
  RowDataPacket {
    id: 7,
    title: 'foo',
    date: 2021-12-15T16:00:12.000Z
  }
]

How can I return this within a response to an API call without it being returned as [object, object]?

I want to return it without it being a string as a string isn't that useable compared to JSON.

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