Using C client library (libmosquitto)
How to publish this json string to MQTT mosquitto broker
"book":[
{"Name":"xyz", "price":"5.00"},
{"Name":"abc", "price":"10.00"},
{"Name":"hello world", "price":"15.00"}
]}
using this function.
mosquitto_publish(mosq, NULL, "xyz", 10, "5.00", 2, false);
int mosquitto_publish( mosq, mid, topic, payloadlen, payload, qos, retain);