I'm exploring a new project with an import/export feature in mind. Initially, I will have an array containing approximately 45 simple objects structured like this:
{"id": "someId", "quantity": 3}
To make it exportable, the entire array of objects needs to be converted into a single string. My plan is to use JSON.stringify() for this purpose. However, I aim to shorten the resulting string as much as possible for user convenience (copying and pasting to share with others for importing back into the original array). Although not essential, my goal is to minimize the length of the string. So, the question remains - how can I convert an array of objects into the shortest possible string?
Any techniques like Encoding, Encryption, or Hashing are welcome, as long as they are reversible to retrieve the original data.
When I say "shortest possible," I am open to any solution that generates a shorter string than straightforward stringification. The most concise method will be accepted.
I experimented with text minification, but its results were similar to the original text. Encryption also resulted in a relatively lengthy output.
Note: The import string (obtained from exporting) can be either human-readable or unreadable.