iterative through json data in flask application

66
May 03, 2021, at 02:00 AM

I've a sample flask application

app.route('/xyz', methods=['POST'])
def main():
     data = request.json
     for item in data:
         name = item['name']
         id = item['id']
         print(name, id)
         return "1"

I'm trying to hit the route with

[
     {
          "name": "Sam wilson",
          "id": 12345,
     },
     {
           "name": "John K.",
           "id": 4444,
      }
] 

But it's printing only

Sam Wilson
12345

But not

Sam Wilson
12345
John K.
12345

Can anyone help me out here?

READ ALSO
how do i rectify the undefined output for this.Status?

how do i rectify the undefined output for this.Status?

My AJAX code for a reqres server doe not display the desired output or it does not update the default text when hit on submitenter image description here

25
How to write an equation with a changing variable and a click counter, but the result stays the same? [closed]

How to write an equation with a changing variable and a click counter, but the result stays the same? [closed]

Want to improve this question? Update the question so it focuses on one problem only by editing this post

23
Trying to execute an update query where rows are variables from TEdit

Trying to execute an update query where rows are variables from TEdit

I have a table which has values that need to be updatedThere are quite a few typos as different people have added items in the past, so I have to use 'like' despite everything

54
Can I have only one Xamarin Content Page with no full screen in Android?

Can I have only one Xamarin Content Page with no full screen in Android?

I have seted android:windowFullscreen = false for achiving to fix an issue that was kicking out from screen some element views when soft keyboard is openI was able to solve the problem, but now my whole app has no full screen mode

43