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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:42:56+00:00 2026-06-01T01:42:56+00:00

I have a dictionary of unknown depth and structure. It might contain more dictionaries,

  • 0

I have a dictionary of unknown depth and structure. It might contain more dictionaries, lists of dictionaries, etc. It’s created from deserializing some JSON input created by another system. There’s a key, perhaps multiple keys with the same name, at various places in that dictionary. I’d like to get the values at each of those keys and ideally update them.

Given a directory structure like this:

{
  "tags":{
    "social-1":{
      "email":True,
      "twitter":True,
      "facebook":True,
      "linkedin":True,
      "type":"social"
    },
    "primary":{
      "type":"flexible",
      "width":"auto",
      "blocks":[
        {
          "type":"combo",
          "data":{
            "styles":{
              "margin":"10",
              "padding":"0",
              "borderColor":"#000",
              "borderWidth":"0",
              "borderStyle":"solid",
              "backgroundColor":"transparent",
              "width":"auto"
            },
            "placeholder":True,
            "headline":{
              "visible":False
            },
            "subHeadline":{
              "visible":False
            },
            "imageHolder":{
              "visible":True,
              "value":[
                {
                  "url":None,
                  "caption":None,
                  "width":220,
                  "height":140,
                  "padding":10,
                  "alt":"",
                  "href":None,
                  "filePath":None,
                  "sizing":"original",
                  "source":"disk",
                  "displayWidth":200,
                  "displayHeight":140,
                  "displayPadding":{
                    "left":10,
                    "top":0,
                    "right":10,
                    "bottom":10
                  }
                }
              ],
              "smartSizing":True,
              "captions":False,
              "captionDefault":None
            },
            "content":{
              "visible":True,
              "value":"<p>Your text here.</p>"
            },
            "imagePosition":"left",
            "textWrap":False,
            "type":"combo"
          }
        },
        {
          "type":"image",
          "data":{
            "styles":{
              "margin":"10",
              "padding":"0",
              "borderColor":"#000",
              "borderWidth":"0",
              "borderStyle":"solid",
              "backgroundColor":"transparent",
              "width":"auto"
            },
            "placeholder":False,
            "imageHolder":[
              {
                "url":None,
                "caption":None,
                "width":0,
                "height":140,
                "padding":10,
                "alt":"",
                "href":None,
                "filePath":None,
                "sizing":"original",
                "source":"disk",
                "displayWidth":213,
                "displayHeight":159,
                "displayPadding":{
                  "left":10,
                  "top":10,
                  "right":5,
                  "bottom":10
                }
              },
              {
                "url":None,
                "caption":None,
                "width":0,
                "height":140,
                "padding":10,
                "alt":"",
                "href":None,
                "filePath":None,
                "displayWidth":213,
                "displayHeight":159,
                "source":"disk",
                "sizing":"original",
                "displayPadding":{
                  "left":5,
                  "top":10,
                  "right":5,
                  "bottom":10
                }
              },
              {
                "url":None,
                "caption":None,
                "width":0,
                "height":140,
                "padding":10,
                "alt":"",
                "href":None,
                "filePath":None,
                "displayWidth":213,
                "displayHeight":159,
                "source":"disk",
                "sizing":"original",
                "displayPadding":{
                  "left":5,
                  "top":10,
                  "right":10,
                  "bottom":10
                }
              }
            ],
            "orientation":"horizontal",
            "smartSizing":True,
            "captions":False,
            "captionDefault":None,
            "type":"image"
          }
        }
      ]
    }
  }
}

How would I examine and update the values of the imageHolder keys?

  • 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-06-01T01:42:57+00:00Added an answer on June 1, 2026 at 1:42 am

    You can use a recursive function descending into list and dictionary values:

    def get_all(data, key):
        sub_iter = []
        if isinstance(data, dict):
            if key in data:
                yield data[key]
            sub_iter = data.itervalues()
        if isinstance(data, list):
            sub_iter = data
        for x in sub_iter:
            for y in get_all(x, key):
                yield y
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does VBA have dictionary structure? Like key<>value array?
I have a dictionary that has keys associated with lists. mydict = {'fruits': ['banana',
I have a dictionary in an unknown language. I have to find all the
I have a Dictionary and a List of keys to remove from the dictionary.
I have dictionary database and i have created one UI interface ,to place buttons
I have dictionary of lists, like so: D = {'x': [15, 20], 'y': [11,
Have Dictionary <Int64, byte> that gets used a lot. I mean in a loop
I have dictionary, like Dictionary<string, bool> accValues = new Dictionary<string, bool>() And I want
I have a Dictionary where the key and value are both strings. It's possible
I have a dictionary, user_dict, and create a list for each user value, this

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.