title: What is a JSON octet and why are two required?
body: <p>I have incoming data, which I store in a variable <code>messages</code>:</p>
  
  <pre><code>connection = ContextIO::Connection.new(key, secret)
  messages = connection.all_messages(:account =&gt; account, :limit =&gt; 100, :since =&gt; (Time.now - 3000.day ))
  </code></pre>
  
  <p>The variable <code>messages</code> is formatted in JSON.  Then I execute this:</p>
  
  <pre><code> foo = JSON.parse(messages)['data']
  </code></pre>
  
  <p>Most of the time this works.  Every now and again, I get this error message: </p>
  
  <pre><code>  A JSON text must at least contain two octets!  
  </code></pre>
  
  <p>That error message then refers to the line <code>JSON.parse(messages)['data']</code></p>
  
  <ol>
  <li><p>What is an octet?  </p></li>
  <li><p>Why must JSON text contain at least two octets?</p></li>
  <li><p>How do I prevent my code from breaking every time <code>messages</code> does not have two octets?</p></li>
  </ol>
  
  <p>Thanks!</p>