Mapping SQL Query result into JSON