Unable to print date and time in JSON format

I am trying to send the sensor DHT11 data to AWS cloud in JSON format for further analysations. I am able to send Temperature and Humidity values to the cloud in JSON format but unable to send time. I am using the NTP protocol to send date and time. I added all the necessary libraries and if i use
formattedDate = timeClient.getFormattedDate();
Serial.println(formattedDate);
This works fine. But I want to print it in JSON format so i am using
sprintf(payload,"{"timestamp":%s,"temperature":%f,"humidity":%f}",formattedDate,t,h);
Near timestamp it is showing question marks and some boxes. Can I declare a string as %s??

Is a string, or a String?

Near timestamp it is showing question marks and some boxes.

You are trying to format floats using %f but formatting floats using sprintf() in the Arduino IDE is not generally supported, hence the question marks. Convert the floats to strings before using them in sprintf()

See dtostrf()

UKHeliBob:
You are trying to format floats using %f but formatting floats using sprintf() in the Arduino IDE is not generally supported, hence the question marks. Convert the floats to strings before using them in sprintf()

See dtostrf()

from the SE version of the question I know it is an esp32. there float works in sprintf

from the SE version of the question I know it is an esp32. there float works in sprintf

Not really an Arduino at all then.

It was good of the OP to give us all the relevant information