JSON provides a lot of flexibility
: it's human readable, it has explicitly-named/optional/variable-length fields, it provides nesting ... all of this comes with a cost:- extra branching in the parsing code (the parser cannot predict anymore what the next field will be, they could be in any order)
- extra memory allocations, decreased memory locality (due to variable-length/optional fields, and also the tree-like structure).
So if your data consists in a single object composed of a timed-fixed set of little-endian integer fields, you're comparing the above costs to the cost of a single fread call* with no memory allocations.
* many other data formats provide similar flexibility, text-based ones (XML) and also binary-based ones (IFF, protobuf, ISOBMFF, etc.)
don't write it as such though, you must write the endianess-decoding code (which the optimizer should trash anyway on little-endian architectures - e.g LLVM does).