JSON server answer generator from MySQL query