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

196
Views
javascript - call api python passing json and iterate through array

I've this javascript/jquery function:

function getSimulated(){
var arr = [];
var param_alfa = $('#param_alfa').val();
arr.push({'param_note': 'job_id', 'param_id' : '1', 'param_alfa': '', 'param_number' : $('#param_number_1').val()});
arr.push({'param_note': 'desk_01', 'param_alfa': param_alfa, 'param_number': ''});
for(var i = 3; i <= 7; i++){
    var lbl = $('#lbl_'+i).text().replace(/ /g, "_").toLowerCase();
    var param_id = i;
    var param_number = $('#param_number_'+i).val();
    arr.push({'param_note': lbl, 'param_id': param_id, 'param_alfa':'', 'param_number': param_number});
}
console.log(arr);
$.getJSON(getWebAppBackendUrl('/test_call'), {
    json_data: JSON.stringify(arr)
}, function(data){
    console.log(data)
});}

and this is the python entry point

@app.route('/test_call')
def test_call():
   json_obj = request.args.get("json_data")
   data = json.loads(json_obj)
   #this works
   return json.dumps({"status":"ok", "data":data})

I mean "it works" by reading the results in console. They are correct both from javascript and python.

I need to iterate through the 'json_obj' to do some stuff with each value, for ex.:

for i in json_obj:
  param_a = json_obj[i]['param_note']
  param_b = json_obj[i]['param_number']

This doesn't work. I get an empty result.

this is the output of array of objects:

7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
0:
  param_alfa: ""
  param_note: "job_id"
  param_id: 1
  param_number: "79"
  [[Prototype]]: Object
1:
  param_alfa: "Side left"
  param_note: "desk 01"
  param_id: 2
  param_number: "0.2"
  etc....

Thank you all in advance

about 4 years ago · Juan Pablo Isaza
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!