title: How to add square brackets in JSON data with python
body: <p>So I have json data that looks like this:</p>
  
  <pre><code>"responses":[
  {
    "ResponseID" : "R_1mhpDCQzIOlVfPT",
    "ResponseSet" : "Default Response Set",
    "IPAddress" : "",
    "StartDate" : "2016-08-04 11:52:36",
    "EndDate" : "2016-08-04 11:52:53",
    "RecipientLastName" : "",
    "RecipientFirstName" : "",
    "RecipientEmail" : "",
    "ExternalDataReference" : "",
    "Finished" : "1",
    "Status" : "1",
    "Q5" : "",
    "Q6" : "",
    "Q7" : "",
    "Q8" : "",
    "Q9" : "",
    "Q10" : "",
    "Q11" : "",
    "Q12" : "",
    "LocationLatitude" : "33.414794921875",
    "LocationLongitude" : "-111.90930175781",
    "LocationAccuracy" : "-1"
  },
  </code></pre>
  
  <p>I basically want to take all of the Q's and put them in a Questions array within the json. The output should look something like this:</p>
  
  <pre><code>"responses":[
  {
    "ResponseID" : "R_1mhpDCQzIOlVfPT",
    "ResponseSet" : "Default Response Set",
    "IPAddress" : "",
    "StartDate" : "2016-08-04 11:52:36",
    "EndDate" : "2016-08-04 11:52:53",
    "RecipientLastName" : "",
    "RecipientFirstName" : "",
    "RecipientEmail" : "",
    "ExternalDataReference" : "",
    "Finished" : "1",
    "Status" : "1",
    "Questions" : [
       "Q5" : "",
       "Q6" : "",
       "Q7" : "",
       "Q8" : "",
       "Q9" : "",
       "Q10" : "",
       "Q11" : "",
       "Q12" : ""
     ],
    "LocationLatitude" : "33.414794921875",
    "LocationLongitude" : "-111.90930175781",
    "LocationAccuracy" : "-1"
  }
  </code></pre>
  
  <p>How could I go about this and apply this to over 100 responses. Here is what I have so far: </p>
  
  <pre><code>for filename in os.listdir('C:/Users/john/Desktop/Q/QD'):
  if filename.endswith(".json") :
      print(filename)
      with open(filename, encoding="utf8") as data_file:
          data = json.load(data_file)
          for i in data['responses']:
              for j in i:
                  if j.startswith('Q'):
                      print(j)
          input("Press enter to continue...")
  </code></pre>
  
  <p>All this code does is load the data and basically loops through each file within the folder and prints out all the Questions into the console. How would I go about appending the Questions field and adding the square brackets? </p>