userver: /data/code/userver/libraries/protobuf/src/protobuf/json/convert.cpp Source File
Loading...
Searching...
No Matches
convert.cpp
1#include <userver/protobuf/json/convert.hpp>
2
3#include <protobuf/json/impl/read.hpp>
4#include <protobuf/json/impl/write.hpp>
5#include <protobuf/json/impl/write_debug_string.hpp>
6#include <protobuf/json/impl/write_json_string.hpp>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace protobuf::json {
11
12formats::json::ValueBuilder MessageToJsonBuilder(
13 const ::google::protobuf::Message& message,
14 const PrintOptions& options
15) {
16 return impl::WriteMessage(message, options);
17}
18
19void JsonToMessage(
20 const formats::json::Value& json,
21 ::google::protobuf::Message& message,
22 const ParseOptions& options
23) {
24 impl::ReadMessage(json, message, options);
25}
26
27std::string MessageToJsonString(const ::google::protobuf::Message& message, const PrintOptions& options) {
28 return impl::WriteMessageToJsonString(message, options);
29}
30
31std::string MessageToDebugString(const ::google::protobuf::Message& message, std::size_t limit) {
32 return impl::WriteMessageToDebugString(message, limit);
33}
34
35} // namespace protobuf::json
36
37/*
38namespace formats::serialize {
39
40json::Value Serialize(const ::google::protobuf::Message& message, To<json::Value>) {
41 return protobuf::json::MessageToJson(message);
42}
43
44} // namespace formats::serialize
45*/
46
47USERVER_NAMESPACE_END