title: How to convert a javascript object to json
body: <p>I'm trying to convert a JavaScript object to a json.</p>
  
  <p>Practically I have created a website where you can upload a json, edit it and download it with your changes.</p>
  
  <p>For convenience when I edit it creates a javascript object that will be converted at the end of the changes with <code>JSON.stringify</code>.</p>
  
  <p>The problem is that the final Json should have the same characteristics as the initial one with the elements associated to the different key.</p>
  
  <p>For example the first one can be this:</p>
  
  <pre><code>"tickets": {
      "use": "Valida",
      "useagain": "Valida di nuovo",
      "usetitle": "Convalida biglietto",
      "usemessage": "Vuoi convalidare il biglietto ora?",
      "purchaseconfirmtitle": "Confermi l\"acquisto?",
      "purchaseconfirmmessage": "Potrai convalidare il biglietto più tardi",
      "minutes": "Minuti",
  }
  </code></pre>
  
  <p>The result must be like this:</p>
  
  <pre><code>"tickets": {
      "use": "Example",
      "useagain": "Example1",
      "usetitle": "Example2",
      "usemessage": "Example3,
      "purchaseconfirmtitle": "Example4",
      "purchaseconfirmmessage": "5",
      "minutes": "Minuti",
  }
  </code></pre>
  
  <p>How do I make sure that all elements will be children of "ticket" (for example)?</p>