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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:46:05+00:00 2026-05-23T11:46:05+00:00

I have JSON of the following form: {blah: [ [ {first: {something:that,something:else,another:thing,key:value}…[etc.] } ]

  • 0

I have JSON of the following form:

{"blah":
 [
   [
     {"first":
     {"something":"that","something":"else","another":"thing","key":"value"}...[etc.]
     }
   ]
 ]
}

that I’m trying to parse in Python. I’ve imported json (or simplejson, depending on what version of Python you’re using) and everything goes pretty well until I get to this block:

for result in page['blah']:
  that = result['first']
  a_list.append(that)

which throws the error “TypeError: list indices must be integers, not str”.

I’m pretty sure this error is due to the extra pair of square-bracket that makes the JSON inside look like a list.

My question, assuming that’s the case, is, How do I remove it and still have valid JSON to parse as dictionaries?

Other workarounds welcome. If I need to supply more info, let me know. Thanks!

(Added the missing curly bracket and changed a couple of confusing terms–I was trying to come up with generic terms on the fly, sorry for any confusion.)

  • 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-23T11:46:06+00:00Added an answer on May 23, 2026 at 11:46 am

    If there’s always exactly one “extra” set of array brackets:

    for result in page['blah']:
        that = result[0]['this']
        list.append(that)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an html form that has the following structure: <input type=text name=title />
I have the following block of code that renders a form. The form will
I have a JSON object holding the following value: @value = {val:test,val1:test1,val2:test2} I want
I have the following example json output form java/jsonsimple. The JSONArray is: [{dd1:{actionType:Dept,collegeID:}},{dd2:{actionType:Dept,collegeID:}}] I'm
I have the following controller that I am posting to in a form via
I have a form that uses a JQuery Json post. I have 10+ textboxes
currently I have following code: home.php <form name='myformname' id='myformid'> <input type='text' name='mytext1' value='abc'> <input
I have the following JSON structure: [{ id:10, class: child-of-9 }, { id: 11,
I have the following json code file named: sections.json { section1: { priority: 1,
I have the following JSON object: { response: { status: 200 }, messages: [

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.