-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import/Export compressed JSON files #1556
Comments
IMO this would be best accomplished using a user-provided input_adapter and/or output_adapter (see #1534). This would avoid a dependency from this library to external libraries which implement the compression (or encryption since that is a fairly similar problem). Such a user-provided adapter could be provided as another library which is dependent on this one and whichever compression/encryption library (or libraries) it wants to stream using. |
Hello @abrownsword, thank you for your reply. I didn't know about the adapter design pattern (I'm studying it here, tell me if you have a better reference for that). Sorry for my lack of knowledge in design patterns. Anyway, after a quick look into, it seems it could work. Let's wait for @nlohmann opinion. |
@jumpy88 I agree with @abrownsword: We should not add a dependency to a compression library to this library, and input adapters would be the way to realize reading compressed data. |
Hello @nlohmann, as I anticipated in my first post, I too agree with avoiding dependencies which are not strictly required 🙂. So, is this something that can already be done or does it still need additional work on your side? (I've read in #1534 that you are currently working on input adapters). And if it's already usable, can you link some documented examples on how to use it? Thank you for your support |
@nlohmann are input/output adapters already supported by json library? I couldn't find anything about this in the readme. I only find Jonathan Dumaresq implemented an input adapter to read from FILE* |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I've found in the doc it's possible with this library dealing with binary JSON formats (BSON, CBOR, etc.). Anyway looking around the internet one of the most efficient ways of storing JSON files, in terms of space consumption, seems to be using standard JSON format and compress the file in a .json.gz or .json.bz2 file (as shown here and here). I understand this can be done manually with few commands and it could require to add an undesirable dependency of your json.hpp on an external compression library. On the other hand I think it would be a useful nice-to-have doing it with a single line as it is very common using compressed formats for JSON files especially in network data transmission.
The text was updated successfully, but these errors were encountered: