Commit 800f602c authored by Tom Jackson's avatar Tom Jackson Committed by Facebook Github Bot

toPrettyJson() sorts keys for deterministic output

Summary: Diffing logs would be easier if the lines which pretty-printed JSON were identical if their values were identical, and they're just easier to visually scan for a value if they're sorted anyway.

Reviewed By: yfeldblum, luciang

Differential Revision: D17367669

fbshipit-source-id: 91188f23576ce39b9edc2307be018a43f30c786d
parent a821d1c9
......@@ -994,6 +994,7 @@ std::string toJson(dynamic const& dyn) {
std::string toPrettyJson(dynamic const& dyn) {
json::serialization_opts opts;
opts.pretty_formatting = true;
opts.sort_keys = true;
return json::serialize(dyn, opts);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment