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 4602756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:02:17+00:00 2026-05-22T00:02:17+00:00

I am somewhat new to python and I am wondering what the best way

  • 0

I am somewhat new to python and I am wondering what the best way is to generate json in a loop. I could just mash a bunch of strings together in the loop, but I’m sure there is a better way. Here’s some more specifics. I am using app engine in python to create a service that returns json as a response.

So as an example, let’s say someone requests a list of user records from the service. After the service queries for the records, it needs to return json for each record it found. Maybe something like this:

{records: 
{record: { name:bob, email:blah@blah.com, age:25 } },
{record: { name:steve, email:blah@blahblah.com, age:30 } }, 
{record: { name:jimmy, email:blah@b.com, age:31 } }, 
}

Excuse my poorly formatted json. Thanks for your help.

  • 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-22T00:02:18+00:00Added an answer on May 22, 2026 at 12:02 am

    My question is how do I add to the
    dictionary dynamically? So foreach
    record in my list of records, add a
    record to the dictionary.

    You may be looking to create a list of dictionaries.

    records = []
    record1 = {"name":"Bob", "email":"bob@email.com"}
    records.append(record1)    
    record2 = {"name":"Bob2", "email":"bob2@email.com"}
    records.append(record2)
    

    Then in app engine, use the code above to export records as json.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am somewhat new to MVVM. I am not sure what the best way
I'm somewhat new to Python, Django, and I'd like some advice on how to
I'm somewhat new to S3. I'm wondering if it's a good idea to put
I am somewhat new to Python and programming in general so I apologize. By
I am somewhat new to PHP and MySQL, and have just setup a basic
I'm somewhat new to the ASP.NET MVC architecture and I'm trying to sort out
Does VS2008 have somewhat C++0x standard support? DUPLICATE Visual Studio support for new C
I have written a python script which watches a directory for new subdirectories, and
I am somewhat new to transactional databases and have come across an issue I
Relatively new to python. I recently posted a question in regards to validating that

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.