I've been trying to send some integer values over socket to a LabVIEW client using json.dumps
but as the numbers change the size of each field may change, I would like to know if there is a way to pad the number with '0' without turning it into a string when I do the json dump, as it adds " "
to the packet send around each number.
Example:
data = json.dumps({"Data": str(52).zfill(4)]})
self.sock.send(data.encode())
This sends
'"Data":"0052"'
I want
'"Data": 0052'