Skip to content

Use stream json api in protobuf 31 and later versions#32

Closed
chenBright wants to merge 1 commit into
masterfrom
stream_json
Closed

Use stream json api in protobuf 31 and later versions#32
chenBright wants to merge 1 commit into
masterfrom
stream_json

Conversation

@chenBright

Copy link
Copy Markdown
Owner

What problem does this PR solve?

Issue Number:

Problem Summary:

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects:

  • Breaking backward compatibility:


Check List:

@chenBright chenBright force-pushed the stream_json branch 2 times, most recently from 010ad87 to 50235ca Compare May 27, 2025 16:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the json2pb ProtoJSON conversion paths to use protobuf’s newer streaming JSON APIs when building against protobuf 6.31+, reducing intermediate buffering and leveraging the upstream JSON implementation directly.

Changes:

  • Use google::protobuf::json::MessageToJsonStream for ProtoMessage → ProtoJSON when GOOGLE_PROTOBUF_VERSION >= 6031000.
  • Use google::protobuf::json::JsonStreamToMessage for ProtoJSON → ProtoMessage when GOOGLE_PROTOBUF_VERSION >= 6031000.
  • Keep the existing google::protobuf::util::{BinaryToJsonStream, JsonToBinaryStream} fallback for older protobuf versions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/json2pb/pb_to_json.cpp Switch ProtoJSON serialization to protobuf’s streaming JSON API for protobuf 6.31+ with a fallback for older versions.
src/json2pb/json_to_pb.cpp Switch ProtoJSON parsing to protobuf’s streaming JSON API for protobuf 6.31+ with a fallback for older versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/json2pb/pb_to_json.cpp
Comment thread src/json2pb/json_to_pb.cpp
@chenBright chenBright closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants