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

147
Views
analizar la matriz de objetos enviados desde el frontend en el backend de python Django

Tengo una aplicación web, backend usando Django, frontend usando HTML5 normal.

En la interfaz, uso axios para enviar una serie de objetos a través de una solicitud POST.

 axios ({ method: 'POST', url: test_url, data: { [{title:1, isbn:1234},{title:2, isbn:5678}] } })

Sin embargo, en el backend, no pude analizar los datos enviados desde el frontend.

 def test_url(request): body = request.body.decode("utf-8") json_acceptable_string = body.replace("'", "\"") d = json.loads(json_acceptable_string) title = d.get('title') ...

Recibí un error de decodificación json en el backend.

¿Cómo podría analizar fácilmente la matriz de objetos enviados desde la interfaz en python?

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

0

puedes intentar algo como esto

https://docs.djangoproject.com/en/4.0/ref/request-response/#django.http.QueryDict.getlist

 js axios ({ method: 'POST', url: test_url, data: { "array_list" : [{"title": 1, "isbn": 1234}, {"title": 2, "isbn": 5678}] } }) python def test_url(request): data = request.POST array = data.getlist('array_list')
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!