title: Read array Objects from Firebase + Firepad + Ace Editor
body: <p>I am storing the data to the Firebase when the user starts typing in the ACE editor with the help of firepad.</p>
  
  <p>The data is stored in the Firebase like an Array. Each character in array index.</p>
  
  <p>I just typed "Hi Its" then "Hi Its Nithi" then inserted "Hi Its Me Nithi"</p>
  
  <p>It's really hard to read the data with key, value, array, index with -ve value.</p>
  
  <p>Is there any plugin to convert handle the index?</p>
  
  <p>Data:</p>
  
  <pre><code>B11
  o
      0: 7 
      1: -1
  B12
  o
      0: 7
      1: "N"
  B13
  o
      0: 8
      1: "ithi" 
  B14
  o
      0: 7
      1: "M"
      2: 5
  B15
  o
      0: 8 
      1: "e"
      2: 5
  </code></pre>
  
  <p>Am really tired by constructing a code like :</p>
  
  <p>Which grow and getting more complex.</p>
  
  <pre><code>codeTimeFirebaseRef.on('value', function(snapshot) {
          var data = snapshot.val();
          var i = 1;
          var jsonData = {};
          var jsonDataArray = {};
          async.forEach(Object.keys(data), function(key) {
            var code = data[key];
            if (code.o.length === 1) {
              if (jsonDataArray.length &gt; 1) {
                jsonData.answer = jsonDataArray;
                codes.push(jsonData);
                i++;
                jsonData = {};
                jsonDataArray = {};
              } else {
                jsonData.index = i;
                jsonData.time = code.t;
                if (typeof code.o[0] === 'string') {
                  jsonDataArray = code.o[0];
                } else if (typeof code.o[0] === 'number') {
                  jsonDataArray = jsonDataArray.substring(0, code.o[0]);
                }
              }
            } else {
              if (typeof code.o[1] === 'string') {
                jsonDataArray += '' + code.o[1];
              } else if (typeof code.o[1] === 'number') {
                jsonDataArray = jsonDataArray.substring(code.o[0], code.o[1]);
              }
            }
  </code></pre>
  
  <p>Please help to get through.</p>