0

I am using JSON because its readable and offers flexibility as a transmission protocol for IPC. Part of the exchange between processes is a requirement to transfer large binary files (MB's).

I am using UDP and JSON as the transport protocol, in this case the binary data is translated into HEX strings with no delimiters so a single 8 bit character is used to represent each 4 bit nibble.

I'm exploring and looking for ways of keeping the JSON protocol but getting a more efficient way to transferring the binary hex data.

The reason for this is that UDP packets are limited in size and converting each nibble to a byte doubles the bit count and slows down the transfer as the data size is doubled.

Can anyone think of a better way of sending the binary data in a JSON packet without loosing anything?

SPlatten
  • 5,334
  • 11
  • 57
  • 128
  • 1
    The obvious choice would be base64, but also read this: https://stackoverflow.com/questions/1443158/binary-data-in-json-string-something-better-than-base64#:~:text=The%20JSON%20format%20natively%20doesn,data%20is%20to%20use%20Base64. – CherryDT Jul 06 '21 at 09:29

1 Answers1

0

I recommend Parket to submit information, Parket is a single table binary format, this format is used in machine learning in Python, here are some examples. Link Link

if your reason is UDP packets maybe try sockets: Link again, :) I hope it helps you, greetings

John_B
  • 41
  • 8
  • Link doesn't work...also JSON is used throughout the system, this is just a small part of an existing protocol. – SPlatten Jul 06 '21 at 11:35