title: Parse JSON data in Python to CSV file
body: <p>I need to parse the below Json data using python and write to a csv file. Below I have included only 2 server names but my list is big. Please help with sample code to get the desired output.</p>
  
  <p>Below is my json data in a file server_info.json:</p>
  
  <pre><code>{
  "dev-server":
      {
      "hoststatus":
          {
          "host_name":"dev-server",
          "current_state":"2",
          "last_time_up":"1482525184"
          },
      "servicestatus":
          {
          "/ Filesystem Check":
              {
              "host_name":"dev-server",
              "service_description":"/ Filesystem Check",
              "current_state":"1",
              "state_type":"1"
              },
          "/home Filesystem Check":
              {
              "host_name":"dev-server",
              "service_description":"/home Filesystem Check",
              "current_state":"2",
              "state_type":"2"
              }
          }
      },
  "uat-server":
      {
      "hoststatus":
          {
          "host_name":"uat-server",
          "current_state":"0",
          "last_time_up":"1460000000"
          },
      "servicestatus":
          {
          "/ Filesystem Check":
              {
              "host_name":"uat-server",
              "service_description":"/ Filesystem Check",
              "current_state":"0",
              "state_type":"1"
              },
          "/home Filesystem Check":
              {
              "host_name":"uat-server",
              "service_description":"/home Filesystem Check",
              "current_state":"1",
              "state_type":"2"
              }
          }
      }
  }
  </code></pre>
  
  <p>Expected Output:</p>
  
  <p>output format: </p>
  
  <pre><code>hoststatus.host_name,hoststatus.current_state,hoststatus.last_time_up
  -------------------------------------------------------------
  dev-server,2,1482525184
  uat-server,0,1460000000
  </code></pre>
  
  <p>and</p>
  
  <p>output format:</p>
  
  <pre><code>servicestatus.host_name,servicestatus.service_description,servicestatus.current_state,servicestatus.state_type
  --------------------------------------------------------------------------------
  dev-server,/ Filesystem Check,1,1
  dev-server,/home Filesystem Check,2,2
  uat-server,/ Filesystem Check,0,1
  uat-server,/home Filesystem Check,1,2
  </code></pre>