I am interested in exporting a subset of values from a MySQL database into a JSON-formatted file on disk.
I found a link that talks about a possible way to do this:
Using MySQL Shell you can out put directly to JSON using only terminal
echo "Your SQL query" | mysqlsh --sql --result-format=json --uri=[username]@localhost/[schema_name]