Down-integrate from google3.
diff --git a/conformance/conformance_cpp.cc b/conformance/conformance_cpp.cc
index 97ae1a7..ac2f6de 100644
--- a/conformance/conformance_cpp.cc
+++ b/conformance/conformance_cpp.cc
@@ -46,6 +46,7 @@
using google::protobuf::Message;
using google::protobuf::MessageFactory;
using google::protobuf::util::BinaryToJsonString;
+using google::protobuf::util::JsonParseOptions;
using google::protobuf::util::JsonToBinaryString;
using google::protobuf::util::NewTypeResolverForDescriptorPool;
using google::protobuf::util::Status;
@@ -112,8 +113,13 @@
case ConformanceRequest::kJsonPayload: {
string proto_binary;
+ JsonParseOptions options;
+ options.ignore_unknown_fields =
+ (request.test_category() ==
+ conformance::JSON_IGNORE_UNKNOWN_PARSING_TEST);
Status status = JsonToBinaryString(type_resolver, *type_url,
- request.json_payload(), &proto_binary);
+ request.json_payload(), &proto_binary,
+ options);
if (!status.ok()) {
response->set_parse_error(string("Parse error: ") +
status.error_message().as_string());