Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
parse array of objects sent from frontend in python Django backend

I have a web app, backend using Django, frontend using normal HTML5.

I the frontend, I use axios to send an array of objects via POST request.

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

However, in the backend, I could not succeed in parsing the data send from 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')
    ...

I got json decode error in the backend.

How could I easily parse the array of objects sent from frontend in python?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you can try something like this

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda