added function sendJsonResponse()