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

133
Views
JSON: ¿Cómo accedo al "evento" aquí para enviarlo a un middleware JOI?

Así que tengo este objeto JSON:

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

Pero no puedo entender cómo acceder solo a la parte del evento usando este código de validación de esquema, actualmente lo estoy escribiendo como:

 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() }

Devuelve el error de consulta sql como:

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

Y si escribo la const como { event } = req.body dice que es un objeto no válido

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

0

ya resuelto, todo lo que tenía que hacer era eliminar el corchete dentro de mi 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!