title: How to write mysql query to get JSON output?
body: <p>I am exporting a part of MySQL Database as JSON Format.
  I want to do this from mysql-cli without using any web interfaces like phpmyadmin or softwares like mysqlworkbench.</p>
  
  <p>I am aware that I can do so by using php <code>json_encode()</code> function after a mysql query.</p>
  
  <p>But are there any methods that can be used, so that I can write a mysql query to get the dump as JSON.</p>
  
  <p>I used php to do this.</p>
  
  <pre><code>json_encode($result);
  </code></pre>