Back to

Invalid JSON format in Kit's output payload


The output payload of the device is not a valid JSON format.
I’ve tested it in several online JSON/JS parsers and it doesn’t pass the test in any of them.

This is what the Kit is sending as payload:

And this is what it should look in a valid JSON format:


Is there a way to fix this?

Thank you!

Hi @rfernandez

Please, check what I posted here:

There are different topics the kit published. Kits running the latest firmware publishes batch data in a raw format under the topic device/sck/%s/readings/raw instead of the original device/sck/%s/readings. Raw means they push data directly from the internal flash memory without assembling a proper JSON file to save memory resources at the Kit side.

That’s the Ruby function that turns the custom data format into a valid JSON file. You can easily implement it in any other language.

You can also change the firmware to use any publishing format that you like. However, currently, we only support this one.

Thank you very much for your answer.
I apologize, as I feel there are some underlying concepts I’m missing.

Please let me rephrase what you said to check if I understood well: and please feel free to correct me if I misunderstood anything.

  • The device changed the way it publishes information. Previous versions of the firmware published to the “…/readings” topic in JSON format. Current (latest) version of the firmware publishes to the “…/readings/raw” topic that is not formated to JSON before publishing, to save resources on the device. And, it is not publishing to the “…/readings” topic anymore.

So the readings I’ll be getting are in the form that is shown in the shell:

and I will get them under the “…/readings/raw” topic in my broker.

Thank you !!

P.S. I was not able to implement mosquitto_sub -h -p 1883 -t device/sck/+/+. For some reason I was not able to determine yet, my broker denies the subscriptions from mosquito_sub; maybe has something to do with a particular Windows configuration.