title: How to convert SQL Query to JSON format
body: <p>I am trying to convert my SQL result into JSON format it's showing an error. </p>
  
  <p>SQL Query:</p>
  
  <pre><code> SELECT 
      User.name, 
      Course.title, 
      Member.role 
  FROM User 
  JOIN Member JOIN Course 
      ON User.user_id = Member.user_id 
      AND Member.course_id = Course.course_id 
  ORDER BY 
      Course.title, 
      Member.role DESC, 
      User.name;
  </code></pre>
  
  <p>I have also tried FOR JSON PATH and FOR JSON AUTO but the following error is coming:</p>
  
  <blockquote>
    <p>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'for JSON AUTO' at line 1</p>
  </blockquote>