diff options
author | Sanchay Harneja <sanchay.h@gmail.com> | 2017-02-18 16:57:26 -0800 |
---|---|---|
committer | Sanchay Harneja <sanchay.h@gmail.com> | 2017-02-18 17:06:43 -0800 |
commit | 172e0a6423742a2a2ca9d64917d63d5352a52e3d (patch) | |
tree | 4253ddb58a0c625f34a088fe9a45386c22f5fdf5 /src/google/protobuf/util/json_util.h | |
parent | a9ab38c17178fcedd9b46c09fa33f94d1a6335c3 (diff) | |
download | protobuf-172e0a6423742a2a2ca9d64917d63d5352a52e3d.tar.gz protobuf-172e0a6423742a2a2ca9d64917d63d5352a52e3d.tar.bz2 protobuf-172e0a6423742a2a2ca9d64917d63d5352a52e3d.zip |
Add an option to always print enums as ints in Json API
https://github.com/google/protobuf/issues/2735
Diffstat (limited to 'src/google/protobuf/util/json_util.h')
-rw-r--r-- | src/google/protobuf/util/json_util.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/google/protobuf/util/json_util.h b/src/google/protobuf/util/json_util.h index 6d3cee52..8dda70c3 100644 --- a/src/google/protobuf/util/json_util.h +++ b/src/google/protobuf/util/json_util.h @@ -61,9 +61,13 @@ struct JsonPrintOptions { // set to 0 will be omitted. Set this flag to true will override the default // behavior and print primitive fields regardless of their values. bool always_print_primitive_fields; + // Whether to always print enums as ints. By default they are rendered as + // strings. + bool always_print_enums_as_ints; JsonPrintOptions() : add_whitespace(false), - always_print_primitive_fields(false) { + always_print_primitive_fields(false), + always_print_enums_as_ints(false) { } }; |