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

146
Views
JSON: How do i access "event" here so that i send it to a JOI middleware

So i have this JSON object:

{
    "event": [
        {
        "nombre_organizador": "A",
        "celular_organizador_secundario": "1234567891",
        "nombre_evento": "Torneo de comer"
        }
    ],
    "ticket":[
    {
        "nombre": "Boleto platino",
        "cantidad": null
    }
]
}

But i can't figure out how to only acces the event part using this validateSchema code, i am currenly writing it as:

export const validateCreateEvent = async (req, res, next) => {
  const { event } = req
  const validation = await validateSchema(createEventSchema, event)
  if (validation.err) {
    res.status(400).json({ msg: validation.err })
    console.log(event)
    return
  }
  next()
}

It returns the sql querie error as:

sql: "insert into `eventos` (`event`, `ticket`) values ('[object Object]', '[object Object]')"

And if i write the const as { event } = req.body is says its an invalid object

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

already solved, all i had to do was delete the square bracket within my JSON lmao

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!