title: How to validate json string in PHP like JSON_VALID in mysql?
body: <p>I would like to validate json string before inserting it into mysql database so that JSON_VALID constraint is not violated. Using json_decode like</p>
  <pre><code>json_decode($string, true, 512, JSON_THROW_ON_ERROR);
  </code></pre>
  <p>is not enough because</p>
  <pre><code>json_decode('[&quot;\u001f?\b\u0000\u0000\u0000\u0000\u0000\u0002\u0003KL)NKLI\u0003\u0000z,?o\u0007\u0000\u0000\u0000&quot;]', true, 512, JSON_THROW_ON_ERROR);
  </code></pre>
  <p>throws no error but</p>
  <pre><code>select JSON_VALID('[&quot;\u001f?\b\u0000\u0000\u0000\u0000\u0000\u0002\u0003KL)NKLI\u0003\u0000z,?o\u0007\u0000\u0000\u0000&quot;]') as result; 
  </code></pre>
  <p>returns false. How can I achieve my goal?</p>