title: Is there a max length for JSON field?
body: <p>Hello and good evening,</p>
  
  <p>I writing a simple PHP ecommerce website and I've stumbled upon a problem while doing the administration portion of it.
  I'm currently trying to do an AJAX request to fill some fields on a bootstrap modal and for that I go get the data from a database:</p>
  
  <pre><code>function editProductResponse($productId)
  {
      require 'app/database/Database.php';
      require 'app/models/Product.php';
      require 'app/models/ProductImage.php';
  
      $product = new Product();
      $object = $product-&gt;getProduct($productId);
      $data = $object[0];
      $array = [
          "id" =&gt; $data-&gt;id,
          "name" =&gt; $data-&gt;name,
          //"description" =&gt; $data-&gt;description,
          "price" =&gt; $data-&gt;price,
          "stock" =&gt; $data-&gt;stock,
          "sold" =&gt; $data-&gt;sold,
          "added" =&gt; $data-&gt;added,
          "type" =&gt; $data-&gt;type,
          "subtype" =&gt; $data-&gt;subtype,
          "discount" =&gt; $data-&gt;discount
      ];
      echo print_r($data);
      echo json_encode($array);
  }
  </code></pre>
  
  <p>That's my <code>ajax.php</code> function that gets that actual data and this works fine (bear in mind the commented part of the array is not a mistake, I'll explain that bellow; also i'm doing an array for debug purposes):</p>
  
  <pre><code>stdClass Object
  (
      [id] =&gt; 1
      [name] =&gt; MSI Nightblade MI2-027XES Gaming
      [description] =&gt; Forjado com a paix�o pelo jogo, o MSI Nightblade MI2 foi feito para aqueles que anseiam por uma experi�ncia de jogo imersiva. Com armazenamento em abund�ncia, refrigera��o eficiente e gr�ficos de alta qualidade, esta pequena m�quina gaming est� pronta para desbloquear a sua pr�xima aventura gaming.
      [price] =&gt; 799
      [stock] =&gt; 147
      [sold] =&gt; 32
      [added] =&gt; 2010-11-22
      [type] =&gt; COMPUTER
      [subtype] =&gt; DESKTOP
      [discount] =&gt; 10
  )
  1{"id":1,"name":"MSI Nightblade MI2-027XES Gaming","price":799,"stock":147,"sold":32,"added":"2010-11-22","type":"COMPUTER","subtype":"DESKTOP","0":"discount =&gt; 10"}
  </code></pre>
  
  <p>This is my response in the browser log. Everything appears to be working fine and it is.
  So my <strong>problem</strong> is when I actually uncomment the description part from the array. If I do so, I get this:</p>
  
  <pre><code>stdClass Object
  (
      [id] =&gt; 1
      [name] =&gt; MSI Nightblade MI2-027XES Gaming
      [description] =&gt; Forjado com a paix�o pelo jogo, o MSI Nightblade MI2 foi feito para aqueles que anseiam por uma experi�ncia de jogo imersiva. Com armazenamento em abund�ncia, refrigera��o eficiente e gr�ficos de alta qualidade, esta pequena m�quina gaming est� pronta para desbloquear a sua pr�xima aventura gaming.
      [price] =&gt; 799
      [stock] =&gt; 147
      [sold] =&gt; 32
      [added] =&gt; 2010-11-22
      [type] =&gt; COMPUTER
      [subtype] =&gt; DESKTOP
      [discount] =&gt; 10
  )
  1
  </code></pre>
  
  <p>I left the <code>echo print_r</code> to avoid any confusion on both results.</p>
  
  <p>After I got this response it made me wonder if there's any sort of limit to JSON or if there's some sort of problem with the <code>TEXT</code> SQL data type as the <code>description</code> field is of this type.</p>
  
  <p>As requested, this is the debug response of the actual array:</p>
  
  <pre><code>Array
  (
      [id] =&gt; 1
      [name] =&gt; MSI Nightblade MI2-027XES Gaming
      [description] =&gt; Forjado com a paix�o pelo jogo, o MSI Nightblade MI2 foi feito para aqueles que anseiam por uma experi�ncia de jogo imersiva. Com armazenamento em abund�ncia, refrigera��o eficiente e gr�ficos de alta qualidade, esta pequena m�quina gaming est� pronta para desbloquear a sua pr�xima aventura gaming.
      [price] =&gt; 799
      [stock] =&gt; 147
      [sold] =&gt; 32
      [added] =&gt; 2010-11-22
      [type] =&gt; COMPUTER
      [subtype] =&gt; DESKTOP
      [discount] =&gt; 10
  )
  1
  </code></pre>