title: JavaScript split JSON-string by counting objects (without knowing how many there are)
body: <p>I have multiple values in an JSON structure like this:</p>
  
  <pre><code>[{"Id":22,"Title":"München - Stockholm 31.01.2017 15:00"},{"Id":23,"Title":"Stockholm - München 01.02.2017 18:00"}]
  </code></pre>
  
  <p>I know how to split one of them:</p>
  
  <pre><code>var text = "[{\"Id\":22,\"Title\":\"München - Stockholm 31.01.2017 15:00\"}]";
  console.log(JSON.parse(text)[0].Title.split(","));
  </code></pre>
  
  <p>But how can one split multiple elements?</p>
  
  <p>This would work, but only because I specified that there are 2 items.</p>
  
  <pre><code>var text = "[{\"Id\":22,\"Title\":\"München - Stockholm 31.01.2017 15:00\"},{\"Id\":23,\"Title\":\"Stockholm - München 01.02.2017 18:00\"}]";
  
  var count = Object.keys(text).length;
  console.log(count);
  
  for (var i=0; i &lt; 2; i++){
      console.log(JSON.parse(text)[i].Title.split(","));
  }
  </code></pre>
  
  <p>I wanted to count the objects and use <code>count</code> in the for loop, but the output is 115 and not 2. If I write <code>text[1]</code> the output would be 1, but that doesn't help me either.</p>
  
  <p>Thanks in advance!</p>