{"id":4340,"date":"2025-07-07T08:10:36","date_gmt":"2025-07-07T08:10:36","guid":{"rendered":"http:\/\/www.withdata.com\/blog\/?p=4340"},"modified":"2026-07-15T04:57:33","modified_gmt":"2026-07-15T04:57:33","slug":"mysql-query-to-json","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/mytotxt\/mysql-query-to-json.html","title":{"rendered":"Export MySQL query results to JSON"},"content":{"rendered":"<p>Want to export data from  <a href=\"https:\/\/www.mysql.com\/\">MySQL<\/a>  query to JSON file?<\/p>\n<p>Try Withdata <a href=\"https:\/\/www.withdata.com\/db-to-file\/\">DBToFile<\/a>, a MySQL to JSON converter for Windows, Linux, and macOS, Export MySQL data to JSON, Easy and Fast. <\/p>\n<ul>\n<li>Can run in <span id=\"gui\">GUI<\/span> mode, <a href=\"#convert\">Step by Step<\/a>, just a few mouse clicks.<\/li>\n<li>Can run in <a href=\"\/tools\/db-to-file\/mysql-to-json-cmd\" target=\"_blank\">Command line<\/a>, for <a href=\"\/tools\/db-to-file\/mysql-to-json-task\" target=\"_blank\">Scheduled Tasks<\/a> and Streams.<\/li>\n<li>Support <a href=\"\/tools\/db-to-file\/mysql-to-json-windows\" target=\"_blank\">Windows<\/a>, <a href=\"\/tools\/db-to-file\/mysql-to-json-linux\" target=\"_blank\">Linux<\/a>, and <a href=\"\/tools\/db-to-file\/mysql-to-json-macos\" target=\"_blank\">macOS<\/a>.<\/li>\n<\/ul>\n<p><a href=\"#download-top\" onclick=\"dtv.style.display = 'block';\">Download Withdata DBToFile<\/a>  <a href=\"#download-top\" onclick=\"dtv.style.display = 'block';\"><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/download_3.jpg\" alt=\"Download DBToFile\" width=\"80\" height=\"22\" style=\"max-width:100%;height:auto;\" \/><\/a> <span id=\"dtv\" style=\"display: none;\"><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=win64\">Windows 64 bit<\/a><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=win32\">Windows 32 bit<\/a><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=deb\">Linux .deb (For Debian, Ubuntu) 64 bit<\/a><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=rpm\">Linux .rpm (For Red Hat, Fedora, SUSE) 64 bit<\/a><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=pkg\">MacOS 64 bit<\/a><br \/>\n<\/span><\/p>\n<h2 id=\"export\">Export data from MySQL query to JSON file<\/h2>\n<p><a href=\"#login\">Login to MySQL<\/a> -> <a href=\"#source\">Enter MySQL query<\/a> -> <a href=\"#target\">Set JSON file options<\/a> -> <a href=\"#do\">Export MySQL query to JSON<\/a><\/p>\n<p id=\"login\"> Choose MySQL and logon.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/logon\/choose_mysql_logon.png\" alt=\"export MySQL query to JSON file - Choose MySQL and logon\" width=\"430\" height=\"442\" style=\"max-width:100%;height:auto;display:block;\" \/><\/p>\n<p> Click &#8220;Export From Query&#8221; at task dialog.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/dbtofile\/wizard-task.png\" ALT=\"Export data from MySQL Query To Json File - task window\" width=\"636\" height=\"457\" style=\"max-width:100%;height:auto;display:block;\" loading=\"lazy\" decoding=\"async\"><\/p>\n<p>Select JSON file type.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/dbtofile\/select-json-type.png\" ALT=\"Export Query Results from MySQL Query To JSON File - select JSON file type\" width=\"489\" height=\"200\" style=\"max-width:100%;height:auto;display:block;\" loading=\"lazy\" decoding=\"async\"><\/p>\n<h3 id=\"source\">1. Enter MySQL query.<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/dbtofile\/query-to-a-file-source.png\" ALT=\"Unload data from MySQL Query ResultSet To JSON File - enter query clause\" width=\"722\" height=\"572\" style=\"max-width:100%;height:auto;display:block;\" loading=\"lazy\" decoding=\"async\"><\/p>\n<h3 id=\"target\">2. Set JSON file options.<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/dbtofile\/query-to-json-target.png\" ALT=\"Extract data from MySQL Query Results To JSON File - enter file name\" width=\"722\" height=\"572\" style=\"max-width:100%;height:auto;display:block;\" loading=\"lazy\" decoding=\"async\"><\/p>\n<h3>3. Set rows options.<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/dbtofile\/query-to-json-summary.png\" ALT=\"Convert data from MySQL Query ResultSet To JSON File - summary\" width=\"722\" height=\"572\" style=\"max-width:100%;height:auto;display:block;\" loading=\"lazy\" decoding=\"async\"><\/p>\n<h3 id=\"do\">4. Export MySQL query results to JSON file.<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/dbtofile\/query-to-json-convert.png\" ALT=\"Dump data from MySQL SQL Query To JSON File - export\" width=\"722\" height=\"572\" style=\"max-width:100%;height:auto;display:block;\" loading=\"lazy\" decoding=\"async\"><\/p>\n<p>After exporting, you can view output JSON files.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/datafileconverter\/wizard_view_json.png\" alt=\"Export data from MySQL Query Results To JSON File - view JSON file\" width=\"722\" height=\"572\" style=\"max-width:100%;height:auto;display:block;\" loading=\"lazy\" decoding=\"async\" \/><\/p>\n<hr style=\"clear: both;\" \/>\n<p>More about <a href=\"\/tools\/db-to-file\/mysql-to-json\">MySQL to JSON converter<\/a><\/p>\n<div id=\"download-bottom\" style=\"clear: both;\">\n<p>Download Withdata DBToFile<a href=\"#download-bottom\" onclick=\"dbv.style.display = 'block';\"><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/btn_download_green.png\" alt=\"Download DBToFile\" width=\"165\" height=\"50\" style=\"max-width:100%;height:auto;\" loading=\"lazy\" decoding=\"async\" \/><\/a> <span id=\"dbv\" style=\"display: none;\"><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=win64\">Windows 64 bit<\/a><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=win32\">Windows 32 bit<\/a><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=deb\">Linux .deb (For Debian, Ubuntu) 64 bit<\/a><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=rpm\">Linux .rpm (For Red Hat, Fedora, SUSE) 64 bit<\/a><br \/>\n<a href=\"\/download.php?app=DBToFile&#038;ver=pkg\">MacOS 64 bit<\/a><br \/>\n<\/span><\/p>\n<\/div>\n<p>See also: <\/p>\n<ul>\n<li><a href=\"https:\/\/www.withdata.com\/blog\/mytotxt\/mysql-to-json.html\">Export MySQL table to JSON<\/a><\/li>\n<li><a href=\"https:\/\/www.withdata.com\/blog\/mytotxt\/similar-mysql-tables-to-single-json.html\">Export multiple similar MySQL tables to one JSON file<\/a><\/li>\n<li><a href=\"https:\/\/www.withdata.com\/blog\/mytotxt\/batch-mysql-tables-to-json-files.html\">Batch export MySQL tables to JSON files<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Want to export data from MySQL query to JSON file? Try Withdata DBToFile, a MySQL to JSON converter for Windows, Linux, and macOS, Export MySQL data to JSON, Easy and Fast. Can run in GUI mode, Step by Step, just a few mouse clicks. Can run in Command line, for Scheduled Tasks and Streams. Support [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[16,1418,1323],"class_list":["post-4340","post","type-post","status-publish","format-standard","hentry","category-mytotxt","tag-export","tag-json","tag-mysql"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/4340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/comments?post=4340"}],"version-history":[{"count":14,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/4340\/revisions"}],"predecessor-version":[{"id":41913,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/4340\/revisions\/41913"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=4340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=4340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=4340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}