Better error trapping on MySQL to JSON.