title: A Python script that can navigate a .json and export a .csv based on a search term
body: <p>I want to take a .json of &quot;_PRESET...&quot; items and their &quot;code-state&quot;s with &quot;actions&quot; that contain other &quot;code-state&quot;s, &quot;appearance&quot;s, and &quot;switch&quot;s and turn it into .csv produced from the actions under a given &quot;_PRESET...&quot;, including the &quot;code-state&quot;s and the &quot;actions&quot; listed under their individual entries.</p>
  <p>This would allow a user to enter the &quot;_PRESET...&quot; name and receive a 3-column .csv file containing each action's &quot;type&quot;, name, and &quot;value&quot;. There are of course ways to export the entire .json easily, but I can't fathom a way to navigate it like is needed.</p>
  <p><em>enters &quot;_PRESET_Config_A&quot;</em> for</p>
  <p>input.json:</p>
  <pre><code>{
      &quot;abc_data&quot;: {
          &quot;_PRESET_Config_A&quot;: {
              &quot;properties&quot;: {
                  &quot;category&quot;: &quot;configuration&quot;, 
                  &quot;name&quot;: &quot;_PRESET_Config_A&quot;, 
                  &quot;collection&quot;: null, 
                  &quot;description&quot;: &quot;&quot;
              }, 
              &quot;actions&quot;: {
                  &quot;EN-R9&quot;: {
                      &quot;type&quot;: &quot;code_state&quot;, 
                      &quot;value&quot;: &quot;on&quot;
                  }
              }
          },
          &quot;PN4FP&quot;: {
              &quot;properties&quot;: {
                  &quot;category&quot;: &quot;uncategorized&quot;, 
                  &quot;name&quot;: &quot;PN4FP&quot;, 
                  &quot;collection&quot;: null, 
                  &quot;description&quot;: &quot;&quot;
              }, 
              &quot;actions&quot;: {
                  &quot;E_xxxxxx_Default&quot;: {
                      &quot;type&quot;: &quot;appearance&quot;, 
                      &quot;value&quot;: &quot;M_Red&quot;
                  }
              }
          },
          &quot;HEDIS&quot;: {
              &quot;properties&quot;: {
                  &quot;category&quot;: &quot;uncategorized&quot;, 
                  &quot;name&quot;: &quot;HEDIS&quot;, 
                  &quot;collection&quot;: null, 
                  &quot;description&quot;: &quot;&quot;
              }, 
              &quot;actions&quot;: {
                  &quot;E_xxxxxx_Default&quot;: {
                      &quot;type&quot;: &quot;appearance&quot;, 
                      &quot;value&quot;: &quot;M_Purple&quot;
                  }
              }
          }, 
          &quot;_PRESET_Config_B&quot;: {
              &quot;properties&quot;: {
                  &quot;category&quot;: &quot;configuration&quot;, 
                  &quot;name&quot;: &quot;_PRESET_Config_A&quot;, 
                  &quot;collection&quot;: null, 
                  &quot;description&quot;: &quot;&quot;
              }, 
              &quot;actions&quot;: {
                  &quot;HEDIS&quot;: {
                      &quot;type&quot;: &quot;code_state&quot;, 
                      &quot;value&quot;: &quot;on&quot;
                  }
              }
          },
          &quot;EN-R9&quot;: {
              &quot;properties&quot;: {
                  &quot;category&quot;: &quot;uncategorized&quot;,
                  &quot;name&quot;: &quot;EN-R9&quot;,
                  &quot;collection&quot;: null,
                  &quot;description&quot;: &quot;&quot;
              },
              &quot;actions&quot;: {
                  &quot;PN4FP&quot;: {
                      &quot;type&quot;: &quot;code_state&quot;,
                      &quot;value&quot;: &quot;on&quot;
                  }, 
                  &quot;switch_StorageBin&quot;: {
                      &quot;type&quot;: &quot;switch&quot;,
                      &quot;value&quot;: &quot;00_w_Storage_Bin_R9&quot;
                  }
              }
          }
      }
  }
  </code></pre>
  <p>Desired output.csv</p>
  <pre><code>type,name,value
  code_state,EN-R9,on
  code_state,PN4FP,on
  appearance,E_xxxxxx_Default,M_Red
  switch,switch_StorageBin,00_w_Storage_Bin_R9
  </code></pre>