The reason you use specific sizes for types (int8, int16, uint16, etc) is so you know how to read/write them when you move your data between platforms.
x86 is little endian. ARM apparently can be configured to be either.
In real code there should be readXXX and writeXXX functions that read/write data from disk/network and do the byte swapping in there.
You could also just convert everything to JSON, but you're trading space for complexity/time.