Data formats are the languages IoT systems use to package the same sensor reading for transport. JSON and XML are easy for humans to inspect but consume more bytes, while CBOR, Protocol Buffers, and custom binary formats reduce payload size at the cost of readability and tooling simplicity. The right choice depends on your bandwidth budget, battery constraints, debugging needs, and deployment scale.
Common Pitfalls
Sending {‘temperature’: ‘23.5’} as a string instead of {‘temperature’: 23.5} as a number forces consumers to parse strings, breaks numeric queries, and increases message size. Validate that all numeric fields are encoded as JSON numbers — this is the most common IoT data format error.
Adding a new field to a JSON/CBOR message immediately after a firmware update means old consumers (not yet updated) receive unexpected fields. Use additive-only schema changes (never remove or rename fields), version your schemas, and handle unknown fields gracefully in all consumers.
IEEE 754 float64 uses 8 bytes per value — a 10-field sensor reading becomes 80 bytes just for numbers. Integer-scaled fixed point (temperature × 100 as int16) reduces the same reading to 2 bytes per value with identical precision for typical IoT ranges.