Send data over MQTT: json vs string

Hi all!
I am finally able to send a simple message over MQTT using Mosquitto broker and Paho based client. At this point I have a doubt. I am sending to the client a simple string, but I want obviously send the result of another operation (such as a Data ACquisition). What should I do in this case? I read that payload of function below must be a string:
and I read also that I sould send JSON. I tried to do this transformation:

but at this point I think that it’s not the correct way. What do you advise me to do in these cases?

Any help will be appreciated.
Best Regards

I answer myself, in order to close the post and leave information that may be useful to someone. I solved with JSON serialization in UTF-8 encoding. I sent the position data to the mosquitto broker to give it a try and everything worked. Thanks anyway for your attention.