Reputation: 1
I am trying to publish a message in JSON via -m
with a mosquitto publisher. The problem is that my subscriber receive the JSON message without the "" for every single key... so that the format is not JSON any more. Any solution?
I expect something like {"Location":14.647291}
etc.
Upvotes: -1
Views: 75
Reputation: 59771
Wrap the message payload in single quotes. This will be the shell stripping the quotes.
e.g.
mosquitto_pub -t foo/bar -m '{ "hello": "world" }'
or double quotes and escape the internal ones
mosquitto_pub -t foo/bar -m "{ \"hello\": \"world\" }"
Upvotes: 1