From 172e0a6423742a2a2ca9d64917d63d5352a52e3d Mon Sep 17 00:00:00 2001 From: Sanchay Harneja Date: Sat, 18 Feb 2017 16:57:26 -0800 Subject: Add an option to always print enums as ints in Json API https://github.com/google/protobuf/issues/2735 --- src/google/protobuf/util/json_util.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/google/protobuf/util/json_util.h') 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) { } }; -- cgit v1.2.3