Access dictionary with elements from array softcoded












0















I have a dictionary created from JSON. I would like to access items in the dictionairy through arrays containing their keys. Visualised JSON:



{
"name": "Chiel",
"industry": {
"IndustryName": "Computer Science",
"company": {
"companyName": "Apple",
"address": {
"streetName": "Apple Park Way",
"streetNumber": "1"
}
}
},
"hobby": {
"hobbyName": "Music production",
"genre": {
"genreName": "Deep house",
"genreYearOrigin": "1980"
}
}
}


See the following code example:



#create dict
jsonData = '{"name":"Chiel","industry":{"IndustryName":"Computer Science","company":{"companyName":"Apple","address":{"streetName":"Apple Park Way","streetNumber":"1"}}},"hobby":{"hobbyName":"Music production","genre":{"genreName":"Deep house","genreYearOrigin":"1980"}}}'
dictionary = json.loads(jsonData)

#Referencing dict for 'streetName', from array, hardcoded.
companyElements = ["industry", "company", "address", "streetName"]
print(dictionary[companyElements[0]][companyElements[1]][companyElements[2]][companyElements[3]])

#Referencing dict for 'genreName', from array, hardcoded.
hobbyElements = ["hobby", "genre", "genreName"]
print(dictionary[hobbyElements[0]][hobbyElements[1]][hobbyElements[2]])


The problem is that accessing the dictionaries is being done hardcoded. In other words, there are numbers being used (0, 1, 2, 3).



Is it possible to access the dictionairy through an array, but soft coded? So passing in an array (or another data structure) to the dict without making use of numbers? If so, how can one achieve this?










share|improve this question




















  • 1





    Don't post images of textual data, especially when they make it even less readable than a pure text version.

    – Jim Stewart
    Nov 23 '18 at 13:31













  • I changed it to beatified plain text.

    – Chiel
    Nov 23 '18 at 13:40
















0















I have a dictionary created from JSON. I would like to access items in the dictionairy through arrays containing their keys. Visualised JSON:



{
"name": "Chiel",
"industry": {
"IndustryName": "Computer Science",
"company": {
"companyName": "Apple",
"address": {
"streetName": "Apple Park Way",
"streetNumber": "1"
}
}
},
"hobby": {
"hobbyName": "Music production",
"genre": {
"genreName": "Deep house",
"genreYearOrigin": "1980"
}
}
}


See the following code example:



#create dict
jsonData = '{"name":"Chiel","industry":{"IndustryName":"Computer Science","company":{"companyName":"Apple","address":{"streetName":"Apple Park Way","streetNumber":"1"}}},"hobby":{"hobbyName":"Music production","genre":{"genreName":"Deep house","genreYearOrigin":"1980"}}}'
dictionary = json.loads(jsonData)

#Referencing dict for 'streetName', from array, hardcoded.
companyElements = ["industry", "company", "address", "streetName"]
print(dictionary[companyElements[0]][companyElements[1]][companyElements[2]][companyElements[3]])

#Referencing dict for 'genreName', from array, hardcoded.
hobbyElements = ["hobby", "genre", "genreName"]
print(dictionary[hobbyElements[0]][hobbyElements[1]][hobbyElements[2]])


The problem is that accessing the dictionaries is being done hardcoded. In other words, there are numbers being used (0, 1, 2, 3).



Is it possible to access the dictionairy through an array, but soft coded? So passing in an array (or another data structure) to the dict without making use of numbers? If so, how can one achieve this?










share|improve this question




















  • 1





    Don't post images of textual data, especially when they make it even less readable than a pure text version.

    – Jim Stewart
    Nov 23 '18 at 13:31













  • I changed it to beatified plain text.

    – Chiel
    Nov 23 '18 at 13:40














0












0








0








I have a dictionary created from JSON. I would like to access items in the dictionairy through arrays containing their keys. Visualised JSON:



{
"name": "Chiel",
"industry": {
"IndustryName": "Computer Science",
"company": {
"companyName": "Apple",
"address": {
"streetName": "Apple Park Way",
"streetNumber": "1"
}
}
},
"hobby": {
"hobbyName": "Music production",
"genre": {
"genreName": "Deep house",
"genreYearOrigin": "1980"
}
}
}


See the following code example:



#create dict
jsonData = '{"name":"Chiel","industry":{"IndustryName":"Computer Science","company":{"companyName":"Apple","address":{"streetName":"Apple Park Way","streetNumber":"1"}}},"hobby":{"hobbyName":"Music production","genre":{"genreName":"Deep house","genreYearOrigin":"1980"}}}'
dictionary = json.loads(jsonData)

#Referencing dict for 'streetName', from array, hardcoded.
companyElements = ["industry", "company", "address", "streetName"]
print(dictionary[companyElements[0]][companyElements[1]][companyElements[2]][companyElements[3]])

#Referencing dict for 'genreName', from array, hardcoded.
hobbyElements = ["hobby", "genre", "genreName"]
print(dictionary[hobbyElements[0]][hobbyElements[1]][hobbyElements[2]])


The problem is that accessing the dictionaries is being done hardcoded. In other words, there are numbers being used (0, 1, 2, 3).



Is it possible to access the dictionairy through an array, but soft coded? So passing in an array (or another data structure) to the dict without making use of numbers? If so, how can one achieve this?










share|improve this question
















I have a dictionary created from JSON. I would like to access items in the dictionairy through arrays containing their keys. Visualised JSON:



{
"name": "Chiel",
"industry": {
"IndustryName": "Computer Science",
"company": {
"companyName": "Apple",
"address": {
"streetName": "Apple Park Way",
"streetNumber": "1"
}
}
},
"hobby": {
"hobbyName": "Music production",
"genre": {
"genreName": "Deep house",
"genreYearOrigin": "1980"
}
}
}


See the following code example:



#create dict
jsonData = '{"name":"Chiel","industry":{"IndustryName":"Computer Science","company":{"companyName":"Apple","address":{"streetName":"Apple Park Way","streetNumber":"1"}}},"hobby":{"hobbyName":"Music production","genre":{"genreName":"Deep house","genreYearOrigin":"1980"}}}'
dictionary = json.loads(jsonData)

#Referencing dict for 'streetName', from array, hardcoded.
companyElements = ["industry", "company", "address", "streetName"]
print(dictionary[companyElements[0]][companyElements[1]][companyElements[2]][companyElements[3]])

#Referencing dict for 'genreName', from array, hardcoded.
hobbyElements = ["hobby", "genre", "genreName"]
print(dictionary[hobbyElements[0]][hobbyElements[1]][hobbyElements[2]])


The problem is that accessing the dictionaries is being done hardcoded. In other words, there are numbers being used (0, 1, 2, 3).



Is it possible to access the dictionairy through an array, but soft coded? So passing in an array (or another data structure) to the dict without making use of numbers? If so, how can one achieve this?







python arrays dictionary data-structures hardcode






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 13:40







Chiel

















asked Nov 23 '18 at 13:27









ChielChiel

134114




134114








  • 1





    Don't post images of textual data, especially when they make it even less readable than a pure text version.

    – Jim Stewart
    Nov 23 '18 at 13:31













  • I changed it to beatified plain text.

    – Chiel
    Nov 23 '18 at 13:40














  • 1





    Don't post images of textual data, especially when they make it even less readable than a pure text version.

    – Jim Stewart
    Nov 23 '18 at 13:31













  • I changed it to beatified plain text.

    – Chiel
    Nov 23 '18 at 13:40








1




1





Don't post images of textual data, especially when they make it even less readable than a pure text version.

– Jim Stewart
Nov 23 '18 at 13:31







Don't post images of textual data, especially when they make it even less readable than a pure text version.

– Jim Stewart
Nov 23 '18 at 13:31















I changed it to beatified plain text.

– Chiel
Nov 23 '18 at 13:40





I changed it to beatified plain text.

– Chiel
Nov 23 '18 at 13:40












3 Answers
3






active

oldest

votes


















1














A possible solution is (from the example you provided):



def get_element(dictionary, array):
x = dictionary.copy()
for i in array:
x = x[i]
return x

companyElements = ["industry", "company", "address", "streetName"]
hobbyElements = ["hobby", "genre", "genreName"]

print(get_element(dictionary, companyElements))
print(get_element(dictionary, hobbyElements))





share|improve this answer

































    1














    You could write a function that iterates the given keys.



    Beware that the following implementation will not catch exceptions if one or more keys are missing in your JSON:



    import json
    import copy
    #create dict
    jsonData = '{"name":"Chiel","industry":{"IndustryName":"Computer Science","company":{"companyName":"Apple","address":{"streetName":"Apple Park Way","streetNumber":"1"}}},"hobby":{"hobbyName":"Music production","genre":{"genreName":"Deep house","genreYearOrigin":"1980"}}}'
    dictionary = json.loads(jsonData)

    #Referencing dict for 'streetName', from array, hardcoded.
    companyElements = ["industry", "company", "address", "streetName"]

    #Referencing dict for 'genreName', from array, hardcoded.
    hobbyElements = ["hobby", "genre", "genreName"]

    def get_dict_value(data, keys):
    result = copy.deepcopy(data)
    for key in keys:
    result = result[key]
    return result

    print( get_dict_value(dictionary, companyElements) )
    print( get_dict_value(dictionary, hobbyElements) )


    Result:



    Apple Park Way
    Deep house





    share|improve this answer































      1














      You can use pandas library . It handles file operations very efficiently in Python because it's written in C.
      You could use json_normalize function in Pandas for this task .



      Reference - https://www.kaggle.com/jboysen/quick-tutorial-flatten-nested-json-in-pandas



      import json
      file=open('kk.json')
      inp=json.load(file)
      print(json_normalize(inp))





      share|improve this answer


























      • Where is your code? Please use the example provided here.

        – Chiel
        Nov 23 '18 at 14:15











      • The example you have provided can be solved using normal dictionary way but if you have highly nested file , use json_normalize : import json file=open('kk.json') inp=json.load(file) print(json_normalize(inp))

        – kishan keswani
        Nov 23 '18 at 17:35













      • I don't think this provides a solution that is asked for. Where is companyElements (the array of values used in the dot notation)? Where does it return the values "Apple Park Way" and "Deep House"?

        – Chiel
        Nov 24 '18 at 15:54











      • The documentation you provided is pretty useful though. I started experimenting with Pandas dataframe and it's performance.

        – Chiel
        Nov 24 '18 at 15:55






      • 1





        Hi Chiel , Deep house is there in hobby.genre.genreName and Apple Park Way is under industry.company.address.streetName .

        – kishan keswani
        Nov 24 '18 at 19:22












      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53447598%2faccess-dictionary-with-elements-from-array-softcoded%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      A possible solution is (from the example you provided):



      def get_element(dictionary, array):
      x = dictionary.copy()
      for i in array:
      x = x[i]
      return x

      companyElements = ["industry", "company", "address", "streetName"]
      hobbyElements = ["hobby", "genre", "genreName"]

      print(get_element(dictionary, companyElements))
      print(get_element(dictionary, hobbyElements))





      share|improve this answer






























        1














        A possible solution is (from the example you provided):



        def get_element(dictionary, array):
        x = dictionary.copy()
        for i in array:
        x = x[i]
        return x

        companyElements = ["industry", "company", "address", "streetName"]
        hobbyElements = ["hobby", "genre", "genreName"]

        print(get_element(dictionary, companyElements))
        print(get_element(dictionary, hobbyElements))





        share|improve this answer




























          1












          1








          1







          A possible solution is (from the example you provided):



          def get_element(dictionary, array):
          x = dictionary.copy()
          for i in array:
          x = x[i]
          return x

          companyElements = ["industry", "company", "address", "streetName"]
          hobbyElements = ["hobby", "genre", "genreName"]

          print(get_element(dictionary, companyElements))
          print(get_element(dictionary, hobbyElements))





          share|improve this answer















          A possible solution is (from the example you provided):



          def get_element(dictionary, array):
          x = dictionary.copy()
          for i in array:
          x = x[i]
          return x

          companyElements = ["industry", "company", "address", "streetName"]
          hobbyElements = ["hobby", "genre", "genreName"]

          print(get_element(dictionary, companyElements))
          print(get_element(dictionary, hobbyElements))






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 23 '18 at 13:37

























          answered Nov 23 '18 at 13:32









          FMarazziFMarazzi

          328213




          328213

























              1














              You could write a function that iterates the given keys.



              Beware that the following implementation will not catch exceptions if one or more keys are missing in your JSON:



              import json
              import copy
              #create dict
              jsonData = '{"name":"Chiel","industry":{"IndustryName":"Computer Science","company":{"companyName":"Apple","address":{"streetName":"Apple Park Way","streetNumber":"1"}}},"hobby":{"hobbyName":"Music production","genre":{"genreName":"Deep house","genreYearOrigin":"1980"}}}'
              dictionary = json.loads(jsonData)

              #Referencing dict for 'streetName', from array, hardcoded.
              companyElements = ["industry", "company", "address", "streetName"]

              #Referencing dict for 'genreName', from array, hardcoded.
              hobbyElements = ["hobby", "genre", "genreName"]

              def get_dict_value(data, keys):
              result = copy.deepcopy(data)
              for key in keys:
              result = result[key]
              return result

              print( get_dict_value(dictionary, companyElements) )
              print( get_dict_value(dictionary, hobbyElements) )


              Result:



              Apple Park Way
              Deep house





              share|improve this answer




























                1














                You could write a function that iterates the given keys.



                Beware that the following implementation will not catch exceptions if one or more keys are missing in your JSON:



                import json
                import copy
                #create dict
                jsonData = '{"name":"Chiel","industry":{"IndustryName":"Computer Science","company":{"companyName":"Apple","address":{"streetName":"Apple Park Way","streetNumber":"1"}}},"hobby":{"hobbyName":"Music production","genre":{"genreName":"Deep house","genreYearOrigin":"1980"}}}'
                dictionary = json.loads(jsonData)

                #Referencing dict for 'streetName', from array, hardcoded.
                companyElements = ["industry", "company", "address", "streetName"]

                #Referencing dict for 'genreName', from array, hardcoded.
                hobbyElements = ["hobby", "genre", "genreName"]

                def get_dict_value(data, keys):
                result = copy.deepcopy(data)
                for key in keys:
                result = result[key]
                return result

                print( get_dict_value(dictionary, companyElements) )
                print( get_dict_value(dictionary, hobbyElements) )


                Result:



                Apple Park Way
                Deep house





                share|improve this answer


























                  1












                  1








                  1







                  You could write a function that iterates the given keys.



                  Beware that the following implementation will not catch exceptions if one or more keys are missing in your JSON:



                  import json
                  import copy
                  #create dict
                  jsonData = '{"name":"Chiel","industry":{"IndustryName":"Computer Science","company":{"companyName":"Apple","address":{"streetName":"Apple Park Way","streetNumber":"1"}}},"hobby":{"hobbyName":"Music production","genre":{"genreName":"Deep house","genreYearOrigin":"1980"}}}'
                  dictionary = json.loads(jsonData)

                  #Referencing dict for 'streetName', from array, hardcoded.
                  companyElements = ["industry", "company", "address", "streetName"]

                  #Referencing dict for 'genreName', from array, hardcoded.
                  hobbyElements = ["hobby", "genre", "genreName"]

                  def get_dict_value(data, keys):
                  result = copy.deepcopy(data)
                  for key in keys:
                  result = result[key]
                  return result

                  print( get_dict_value(dictionary, companyElements) )
                  print( get_dict_value(dictionary, hobbyElements) )


                  Result:



                  Apple Park Way
                  Deep house





                  share|improve this answer













                  You could write a function that iterates the given keys.



                  Beware that the following implementation will not catch exceptions if one or more keys are missing in your JSON:



                  import json
                  import copy
                  #create dict
                  jsonData = '{"name":"Chiel","industry":{"IndustryName":"Computer Science","company":{"companyName":"Apple","address":{"streetName":"Apple Park Way","streetNumber":"1"}}},"hobby":{"hobbyName":"Music production","genre":{"genreName":"Deep house","genreYearOrigin":"1980"}}}'
                  dictionary = json.loads(jsonData)

                  #Referencing dict for 'streetName', from array, hardcoded.
                  companyElements = ["industry", "company", "address", "streetName"]

                  #Referencing dict for 'genreName', from array, hardcoded.
                  hobbyElements = ["hobby", "genre", "genreName"]

                  def get_dict_value(data, keys):
                  result = copy.deepcopy(data)
                  for key in keys:
                  result = result[key]
                  return result

                  print( get_dict_value(dictionary, companyElements) )
                  print( get_dict_value(dictionary, hobbyElements) )


                  Result:



                  Apple Park Way
                  Deep house






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 23 '18 at 13:37









                  Mike ScottyMike Scotty

                  5,95052135




                  5,95052135























                      1














                      You can use pandas library . It handles file operations very efficiently in Python because it's written in C.
                      You could use json_normalize function in Pandas for this task .



                      Reference - https://www.kaggle.com/jboysen/quick-tutorial-flatten-nested-json-in-pandas



                      import json
                      file=open('kk.json')
                      inp=json.load(file)
                      print(json_normalize(inp))





                      share|improve this answer


























                      • Where is your code? Please use the example provided here.

                        – Chiel
                        Nov 23 '18 at 14:15











                      • The example you have provided can be solved using normal dictionary way but if you have highly nested file , use json_normalize : import json file=open('kk.json') inp=json.load(file) print(json_normalize(inp))

                        – kishan keswani
                        Nov 23 '18 at 17:35













                      • I don't think this provides a solution that is asked for. Where is companyElements (the array of values used in the dot notation)? Where does it return the values "Apple Park Way" and "Deep House"?

                        – Chiel
                        Nov 24 '18 at 15:54











                      • The documentation you provided is pretty useful though. I started experimenting with Pandas dataframe and it's performance.

                        – Chiel
                        Nov 24 '18 at 15:55






                      • 1





                        Hi Chiel , Deep house is there in hobby.genre.genreName and Apple Park Way is under industry.company.address.streetName .

                        – kishan keswani
                        Nov 24 '18 at 19:22
















                      1














                      You can use pandas library . It handles file operations very efficiently in Python because it's written in C.
                      You could use json_normalize function in Pandas for this task .



                      Reference - https://www.kaggle.com/jboysen/quick-tutorial-flatten-nested-json-in-pandas



                      import json
                      file=open('kk.json')
                      inp=json.load(file)
                      print(json_normalize(inp))





                      share|improve this answer


























                      • Where is your code? Please use the example provided here.

                        – Chiel
                        Nov 23 '18 at 14:15











                      • The example you have provided can be solved using normal dictionary way but if you have highly nested file , use json_normalize : import json file=open('kk.json') inp=json.load(file) print(json_normalize(inp))

                        – kishan keswani
                        Nov 23 '18 at 17:35













                      • I don't think this provides a solution that is asked for. Where is companyElements (the array of values used in the dot notation)? Where does it return the values "Apple Park Way" and "Deep House"?

                        – Chiel
                        Nov 24 '18 at 15:54











                      • The documentation you provided is pretty useful though. I started experimenting with Pandas dataframe and it's performance.

                        – Chiel
                        Nov 24 '18 at 15:55






                      • 1





                        Hi Chiel , Deep house is there in hobby.genre.genreName and Apple Park Way is under industry.company.address.streetName .

                        – kishan keswani
                        Nov 24 '18 at 19:22














                      1












                      1








                      1







                      You can use pandas library . It handles file operations very efficiently in Python because it's written in C.
                      You could use json_normalize function in Pandas for this task .



                      Reference - https://www.kaggle.com/jboysen/quick-tutorial-flatten-nested-json-in-pandas



                      import json
                      file=open('kk.json')
                      inp=json.load(file)
                      print(json_normalize(inp))





                      share|improve this answer















                      You can use pandas library . It handles file operations very efficiently in Python because it's written in C.
                      You could use json_normalize function in Pandas for this task .



                      Reference - https://www.kaggle.com/jboysen/quick-tutorial-flatten-nested-json-in-pandas



                      import json
                      file=open('kk.json')
                      inp=json.load(file)
                      print(json_normalize(inp))






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Nov 23 '18 at 17:37

























                      answered Nov 23 '18 at 13:58









                      kishan keswanikishan keswani

                      309




                      309













                      • Where is your code? Please use the example provided here.

                        – Chiel
                        Nov 23 '18 at 14:15











                      • The example you have provided can be solved using normal dictionary way but if you have highly nested file , use json_normalize : import json file=open('kk.json') inp=json.load(file) print(json_normalize(inp))

                        – kishan keswani
                        Nov 23 '18 at 17:35













                      • I don't think this provides a solution that is asked for. Where is companyElements (the array of values used in the dot notation)? Where does it return the values "Apple Park Way" and "Deep House"?

                        – Chiel
                        Nov 24 '18 at 15:54











                      • The documentation you provided is pretty useful though. I started experimenting with Pandas dataframe and it's performance.

                        – Chiel
                        Nov 24 '18 at 15:55






                      • 1





                        Hi Chiel , Deep house is there in hobby.genre.genreName and Apple Park Way is under industry.company.address.streetName .

                        – kishan keswani
                        Nov 24 '18 at 19:22



















                      • Where is your code? Please use the example provided here.

                        – Chiel
                        Nov 23 '18 at 14:15











                      • The example you have provided can be solved using normal dictionary way but if you have highly nested file , use json_normalize : import json file=open('kk.json') inp=json.load(file) print(json_normalize(inp))

                        – kishan keswani
                        Nov 23 '18 at 17:35













                      • I don't think this provides a solution that is asked for. Where is companyElements (the array of values used in the dot notation)? Where does it return the values "Apple Park Way" and "Deep House"?

                        – Chiel
                        Nov 24 '18 at 15:54











                      • The documentation you provided is pretty useful though. I started experimenting with Pandas dataframe and it's performance.

                        – Chiel
                        Nov 24 '18 at 15:55






                      • 1





                        Hi Chiel , Deep house is there in hobby.genre.genreName and Apple Park Way is under industry.company.address.streetName .

                        – kishan keswani
                        Nov 24 '18 at 19:22

















                      Where is your code? Please use the example provided here.

                      – Chiel
                      Nov 23 '18 at 14:15





                      Where is your code? Please use the example provided here.

                      – Chiel
                      Nov 23 '18 at 14:15













                      The example you have provided can be solved using normal dictionary way but if you have highly nested file , use json_normalize : import json file=open('kk.json') inp=json.load(file) print(json_normalize(inp))

                      – kishan keswani
                      Nov 23 '18 at 17:35







                      The example you have provided can be solved using normal dictionary way but if you have highly nested file , use json_normalize : import json file=open('kk.json') inp=json.load(file) print(json_normalize(inp))

                      – kishan keswani
                      Nov 23 '18 at 17:35















                      I don't think this provides a solution that is asked for. Where is companyElements (the array of values used in the dot notation)? Where does it return the values "Apple Park Way" and "Deep House"?

                      – Chiel
                      Nov 24 '18 at 15:54





                      I don't think this provides a solution that is asked for. Where is companyElements (the array of values used in the dot notation)? Where does it return the values "Apple Park Way" and "Deep House"?

                      – Chiel
                      Nov 24 '18 at 15:54













                      The documentation you provided is pretty useful though. I started experimenting with Pandas dataframe and it's performance.

                      – Chiel
                      Nov 24 '18 at 15:55





                      The documentation you provided is pretty useful though. I started experimenting with Pandas dataframe and it's performance.

                      – Chiel
                      Nov 24 '18 at 15:55




                      1




                      1





                      Hi Chiel , Deep house is there in hobby.genre.genreName and Apple Park Way is under industry.company.address.streetName .

                      – kishan keswani
                      Nov 24 '18 at 19:22





                      Hi Chiel , Deep house is there in hobby.genre.genreName and Apple Park Way is under industry.company.address.streetName .

                      – kishan keswani
                      Nov 24 '18 at 19:22


















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53447598%2faccess-dictionary-with-elements-from-array-softcoded%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      這個網誌中的熱門文章

                      Tangent Lines Diagram Along Smooth Curve

                      Yusuf al-Mu'taman ibn Hud

                      Zucchini