Added logic to properly escape JSON data in MySQL query before executing.