title: Python dump JSON object into another JSON object
body: <p>I'm making a program that generates a JSON file with JSON objects. But I'm having some trouble with making a valid JSON file.</p>
  
  <p>My goal is to make a valid JSON object (See example below) dynamically.</p>
  
  <p>So you start with a empty JSON object: <code>{ }</code>. Then the toruble comes with this: Add a JSON Object:</p>
  
  <pre><code>{
      "Description": "just a making a object",
      "Duration": "ongoing",
      "Image": null,
      "Process": null,
      "day": "Saturday",
      "end": "11:32:34.453694",
      "start": "11:32:31.700324"
  }
  </code></pre>
  
  <p>To that empty JSON object Like this:</p>
  
  <pre><code>{
      "MonTask1": {
          "Description": "just a making a object",
          "Duration": "ongoing",
          "Image": null,
          "Process": null,
          "day": "Saturday",
          "end": "11:32:34.453694",
          "start": "11:32:31.700324"
      },
      "MonTask2": { 
          "Description": "just a making a object",
          "Duration": "ongoing",
          "Image": null,
          "Process": null,
          "day": "Saturday",
          "end": "11:32:34.453694",
          "start": "11:32:31.700324"
      }
  }
  </code></pre>
  
  <p>Is there a way in python3 to accomplish this?</p>
  
  <p>My code is really simple: </p>
  
  <pre><code>def setTask(Day, Time, Description, Duration = None, Process = None, Image = None):
          task = {'day': Day, 'start': Time[0], 'end': Time[1], 'Description': Description, 'Duration': Duration, 'Process': Process, 'Image': Image}
          return task
  
  import json
  
  class jsonObject:
  
  def __init__(self, path):
      self.filePath = path
      with open(self.filePath, 'w') as jsonFile:
          print('File was succesfully created!')
  
  # task is the object made with the setTask method. 
  # Path is the filePath for the JSON file
  def writeToFile(self, task, path):
      jsonFile = open(path + '.json', 'a+')
      json.dump(task, jsonFile, indent = 4, sort_keys=True)
  </code></pre>
  
  <p>Thanks in advance!</p>