I often set up debug messages in my programs in order to view what I’m sending as JSON to the Cloud. Upon first glance it looks fine to me:
{"imu":{"accel_x":-8.043840,"accel_y":0.114912,"accel_z":-4.711392,"orientation":tipped},"weather":{"temp":29.080000,"pressure":100.322167,"humidity":31.941406},"gas":{"co2":426.000000,"voc":3.000000},"distance":{"distance":1.548000,"prox":0.000000,"level":0.000000}}
Looks like normal JSON, right?
Even when I go and format it to make it more readable, it looks ok:
No matter how many times I check though, there isn’t any data showing up on my LightDB Stream console. The reason? It turns out the JSON wasn’t valid after all. I used a JSON online checker to make sure I’m sending valid data using this site:
In my case, no I was not. I was sending a string without quotes around it, which even as the “value” part of a key:value pair needs to have quotes.
Make sure your JSON is valid! If you’d like, you can copy/paste the JSON from above and try out a JSON validation tool for yourself.