Closed timkoers closed 7 years ago
You should escape the inner double quotes using a backslash:
components_feed.publish("{ \"hi\":\"test\"}");
I suggest to use the ArduinoJson library by @bblanchon (https://github.com/bblanchon/ArduinoJson) to encode the JSON data to be published. The same library also helps with the decoding of the received JSON data.
Thank you for the reply @dniklaus.
Also, best place for general questions using libraries would be at our forums at https://forums.adafruit.com.
Thanks!
I am using the ArduinoJson library from bblanchon. Is there any length restriction to the data? EDIT: I did escape the quotes in my code, GitHub formats them away.
I am trying to send JSON trough to my adafruit feed. I feel like this is blocked.
components_feed.publish(output.c_str()); // Some valid json string components_feed.publish("Hi"); components_feed.publish("{ \ "hi\ ":\ "test\ "}");
OUTPUT:
2017-05-08 05:36:05 pm components: Hi 2017-05-08 05:36:05 pm errors: failed to publish value: data missing required value 2017-05-08 05:36:06 pm errors: failed to publish value: data missing required value
Am I doing anything wrong?
Arduino board: ESP 8266 12-F NodeMCU
Arduino IDE version (found in Arduino -> About Arduino menu): Windows Store 1.8.3.0