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

139
Views
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 answers
Answer question

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 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!