Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6133051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:10:38+00:00 2026-05-23T17:10:38+00:00

I have a form that submits data to the server that looks like the

  • 0

I have a form that submits data to the server that looks like the following:

videos[0][type]=Vimeo&
  videos[0][moments][0][time]=11&
  videos[0][moments][0][lng]=111&
  videos[0][moments][0][lat]=111&
  videos[0][moments][1][time]=222&
  videos[0][moments][1][lng]=222&
  videos[0][moments][1][lat]=222&
videos[1][type]=YouTube&
  videos[1][moments][0][time]=111&
  videos[1][moments][0][lng]=111&
  videos[1][moments][0][lat]=111
...

I am using Flask and I would like to be able to loop through the videos and moments but it seems like there isn’t a way to do that. I tried looking for libraries on Google but my Google-fu is weak tonight.

Any suggestions? Thanks!

EDIT: Based on lazy1’s answer, I modified his/her code to

def add(root, path, value):
  for part in path[:-1]:
    root = root.setdefault(part, {})
  root[path[-1]] = value

def parse(s):
  items = {}
  for key, value in parse_qsl(s):
    parts = filter(None, re.split('[\[\]]', key))
    name = parts[0]
    if name not in items: 
      items[name] = {}
    add(items[name], parts[1:], value)
  return items

that will generate a hash:

{'map': {'title': 'orange'}, 'videos': {'1': {'moments': {'0': {'lat': '111', 'lng': '111', 'time': '111'}}, 'type': 'YouTube'}, '0': {'moments': {'1': {'lat': '222', 'lng': '222', 'time': '222'}, '0': {'lat': '111', 'lng': '111', 'time': '11'}}, 'type': 'Vimeo'}}}

for a query that looks like:

map[title]=orange&
videos[0][type]=Vimeo&
  videos[0][moments][0][time]=11&
  videos[0][moments][0][lng]=111&
  videos[0][moments][0][lat]=111&
  videos[0][moments][1][time]=222&
  videos[0][moments][1][lng]=222&
  videos[0][moments][1][lat]=222&
videos[1][type]=YouTube&
  videos[1][moments][0][time]=111&
  videos[1][moments][0][lng]=111&
  videos[1][moments][0][lat]=111
...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:10:39+00:00Added an answer on May 23, 2026 at 5:10 pm

    You can use urlparse.parse_qsl to get the query parameters. However you’ll need manually to construct the video objects.

    Example implementation can be:

    def add(root, path, value):
        for part in path[:-1]:
            root = root.setdefault(part, {})
        root[path[-1]] = value
    
    def parse(s):
        videos = {}
        for key, value in parse_qsl(s):
            parts = filter(None, re.split('[\[\]]', key))
            insert(videos, parts[1:], value)
        return videos
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a form that submits data to a database, i have a function
i have a PHP contact form that submits data, and an email...: <?php $dbh=mysql_connect
I have a button that I would like to disable when the form submits
I have a simple form that passes data to backbone, which in turn, submits
In my page I have a form tag which submits to server, gets data
I have a form that submits a search for blogs on my site via
I have a web form that collects information and submits it to a cgi
I have a simple form in python + pylons that submits to a controller.
I have a website with an existing form, that submits an email address to
I have a checkbox that when it is clicked it submits the form to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.