I think the problem is that this line
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
must be changed to
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_string);
And don't forget to release the allocated data. Good luck!