I want to encode my json files into bytes.
I'm working with sensors that offer a lot of data. Now what I'm doing is obtain each value, convert it to byte using struct.pack(), stack the data and finally send it.
For example, if I have:
{
    'Temperature':9999,
    'Ph': 8888,
    'WindDir': 7777,
    ...
}
I was thinking, maybe exists some function, algorithm, NN, etc that can directly convert this dict to binary, and obviously a decoder.
The idea is doing something like, struct.pack(myFile.json).
I think it's very interesting, because if this is possible I can work not only with numbers, with strings too and send the data as a typical API response.
Note: It's mandatory work in bytes.
 
    