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

  • Home
  • SEARCH
  • 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'm somewhat new to python. I'm trying to sort through a list of strings
I'm somewhat new to C++, coming from python. One piece of functionality I really
I'm somewhat new to OOP with C++, so I'm hoping that I've just made
I'm a somewhat new to python and was looking through the Django source code.
I am somewhat new to Python. I need two functions. The first is supposed
I am somewhat new to Python and programming in general so I apologize. By
I am somewhat new to RESTful APIs. I'm trying to implement a python system
I'm somewhat new to Python, Django, and I'd like some advice on how to
I am somewhat new to unicode and unicode strings. I'm trying to determine the
Alright, i am new to python, and simple tab creation in this language somewhat

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.