Top namespace for the protobuf JSON utilities.
Classes | |
| class | ConversionError |
| JSON/protobuf conversion error. More... | |
| class | ConversionErrorBase |
| Base exception type for JSON/protobuf conversion errors. More... | |
| class | ConversionErrorInfo |
| JSON/protobuf conversion error information. More... | |
| class | JsonError |
| Base exception type for JSON utilities. More... | |
| struct | ParseOptions |
Options which affect how JSON Value is converted to a protobuf message. More... | |
| struct | PrintOptions |
Options which affect how protobuf message is converted to a JSON ValueBuilder/Value. More... | |
Typedefs | |
| using | ParseErrorInfo = ConversionErrorInfo<ParseErrorCode> |
JSON Value to protobuf message conversion error information. | |
| using | PrintErrorInfo = ConversionErrorInfo<PrintErrorCode> |
Protobuf message to JSON Value conversion error information. | |
| using | ParseError = ConversionError<ParseErrorCode> |
JSON Value to protobuf message conversion error. | |
| using | PrintError = ConversionError<PrintErrorCode> |
Protobuf message to JSON Value conversion error. | |
Enumerations | |
| enum class | ParseErrorCode { kUnknownField = 1 , kUnknownEnum = 2 , kMultipleOneofFields = 3 , kInvalidType = 4 , kInvalidValue = 5 } |
JSON Value to protobuf message conversion error code. More... | |
| enum class | PrintErrorCode { kInvalidValue = 1 } |
Protobuf message to JSON Value conversion error code. More... | |
Functions | |
| formats::json::ValueBuilder | MessageToJsonBuilder (const ::google::protobuf::Message &message, const PrintOptions &options) |
Converts protobuf message to JSON ValueBuider. | |
| formats::json::Value | MessageToJson (const ::google::protobuf::Message &message, const PrintOptions &options) |
Converts protobuf message to JSON Value. | |
| void | JsonToMessage (const formats::json::Value &json, ::google::protobuf::Message &message, const ParseOptions &options={}) |
| Converts json to protobuf message . | |
| template<typename T, typename = std::enable_if_t< std::is_base_of_v<::google::protobuf::Message, T> || !std::is_same_v<::google::protobuf::Message, T>>> | |
| T | JsonToMessage (const formats::json::Value &json, const ParseOptions &options={}) |
Converts json to protobuf message of type T. | |
JSON Value to protobuf message conversion error.
Definition at line 125 of file exceptions.hpp.
JSON Value to protobuf message conversion error information.
Definition at line 82 of file exceptions.hpp.
Protobuf message to JSON Value conversion error.
Definition at line 128 of file exceptions.hpp.
Protobuf message to JSON Value conversion error information.
Definition at line 85 of file exceptions.hpp.
|
strong |
JSON Value to protobuf message conversion error code.
Definition at line 17 of file exceptions.hpp.
|
strong |
Protobuf message to JSON Value conversion error code.
| Enumerator | |
|---|---|
| kInvalidValue | Protobuf message field has invalid value. This code can be set when converting well-known message which may have more strict constraints than the types of their fields (see here for example). |
Definition at line 35 of file exceptions.hpp.
| void protobuf::json::JsonToMessage | ( | const formats::json::Value & | json, |
| ::google::protobuf::Message & | message, | ||
| const ParseOptions & | options = {} ) |
Converts json to protobuf message .
| ParseError | if conversion has failed |
| MemberMissingException | is json holds nothing The conversion is perfomed according to ProtoJSON specification. |
proto2 syntax is not fully supported and tested (at least extension fields are not supported). Definition at line 17 of file convert.cpp.
|
nodiscard |
Converts json to protobuf message of type T.
| T | protobuf message type |
| ParseError | if conversion has failed |
| MemberMissingException | is json holds nothing The conversion is perfomed according to ProtoJSON specification. |
proto2 syntax is not fully supported and tested (at least extension fields are not supported). Definition at line 80 of file convert.hpp.
|
inlinenodiscard |
Converts protobuf message to JSON Value.
| PrintError | if conversion has failed The conversion is perfomed according to ProtoJSON specification. |
allow_alias enum option is on) then the first alias in the definition order is outputted. proto2 syntax is not fully supported and tested (at least extension fields are not supported). Definition at line 45 of file convert.hpp.
|
nodiscard |
Converts protobuf message to JSON ValueBuider.
| PrintError | if conversion has failed The conversion is perfomed according to ProtoJSON specification. |
allow_alias enum option is on) then the first alias in the definition order is outputted. proto2 syntax is not fully supported and tested (at least extension fields are not supported). Definition at line 10 of file convert.cpp.