title: How can I turn this string into a JSON object?
body: <p>I have the following string coming in from users and need to turn it into JSON.</p>
  
  <pre><code>2r,5g|3b,2r,4y|3g
  </code></pre>
  
  <p>I would like to convert it to JSON with JavaScript. Here is what I would like the JSON to look like:</p>
  
  <pre><code>rounds = { 
      "round" : {
          "interval" : {
              "time" : "2",
              "color" : "r"
          },
          "interval" : {
              "time" : "5",
              "color" : "g"
          }
      },
      "round" : {
          "interval" : {
              "time" : "3",
              "color" : "b"
          },
          "interval" : {
              "time" : "2",
              "color" : "r"
          },
          "interval" : {
              "time" : "4",
              "color" : "y"
          }
      },
      "round" : {
          "interval" : {
              "time" : "3",
              "color" : "g"
          }
      }
  }
  </code></pre>
  
  <p>I'm not really sure where to start here so any help is appreciated!</p>