Make cJSON_malloc and cJSON_free globally available.

cJSON_PrintUnformatted allocates memory for the string with
cJSON_malloc(), so it must be freed with cJSON_free(), especially if
if the malloc/free hooks are used.
Use cJSON_free() to free memory allocated by cJSON_PrintUnformatted().
Remove empty line.
Use cJSON to build a correct JSON message.