-
Notifications
You must be signed in to change notification settings - Fork 768
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
Implement minimal JSON Print #142
Conversation
The JSON archive uses the RapidJSON::PrettyWriter, which inserts a bunch of extra whitespace. This change adds an option to use the RapidJSON::Writer, which generates a minimum-length string. Signed-off-by: Erich Keane <erich.keane@verizon.net>
Note that this pull request is in response to this conversation here: https://groups.google.com/forum/#!forum/cerealcpp Some Additional Comments: I also attempted to do this with templates, but was unable to do it without doing one of the following: For point a, defining JSONOutputArchive with a template (even with a default parameter) requires declaring a variable using empty brackets: This version would require declaration like so: If anyone has guidance as to whether a templated solution would be better and how to do that, I would be glad to give it a try! Thanks, |
Signed-off-by: Erich Keane <erich.keane@verizon.net>
I'm thinking of trying Idea 2 from above, so I'll likely push it from another branch. My thoughts are to convert the current JSONOutputArchive to a templated version by a different name (JSONOutputArchiveImpl?). Then, create 2 types that inherit directly from this (JSONOutputArchive, MinimalJSONOutputArchive, name suggestions?!) and expose all of its functionality. I suspect that would be a nice balance between maintaining existing functionality and making this a compile-time construct. |
minimal | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Extra vertical whitespace.
$0.02 from my side.
Thanks, |
And thanks a lot for the change, Erich! |
dkorolev-- Thanks for the comments! The more I think about this, the more I think the templated version is a better idea, I'll work that over tomorrow I think. Stay tuned, I might abandon this review and go with another sometime this weekend. |
Just a heads up we may have to drop in a newer version of RapidJSON sooner than we thought (see #144). Not sure how much that will affect this, but chances are any the general structure of any solution will remain the same. I haven't had a chance to really look into your ideas yet, but will give feedback when I can. |
Don't worry about touching this too much. I recently discovered your unit-tests and sandbox tests. I also figured out a way to get this done with templates, so I think this solution is worth abandoning for now. I think the template version will better work with future versions of rapidjson since it doesn't have to edit it as well. |
Was there ever a solution to this? |
The JSON archive uses the RapidJSON::PrettyWriter, which inserts
a bunch of extra whitespace. This change adds an option to use
the RapidJSON::Writer, which generates a minimum-length string.
Signed-off-by: Erich Keane erich.keane@verizon.net