How to convert raw SQL to JSON format in report_card.dataset_query

I am trying to build a text2sql LLM agent to solve simple problem in daily business analysis.
Purpose is text -> SQL -> metabase dashboard

Dig into metabase db, I find the key data is report_card.dataset_query , but the content is json formart, not SQL . I use the web api convert this dataset_query to SQL at first .
But field alias doesn't show in SQL correctly , and I don't find the way convert SQL back to JSON .

Sql back to json is not possible, since a perfect sql parser is not there.