Test json name conflicts

PiperOrigin-RevId: 492380119
diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc
index d1dda61..c1d38b5 100644
--- a/conformance/binary_json_conformance_suite.cc
+++ b/conformance/binary_json_conformance_suite.cc
@@ -2005,6 +2005,21 @@
         optional_int32: 1
         optional_int64: 2
       )");
+  RunValidJsonTest("FieldNameConflict1", REQUIRED,
+                   "{\n \"jsonConflict\": \"hello\"\n}",
+                   R"pb(
+                     json_field_conflict1: "hello"
+                   )pb");
+  RunValidJsonTest("FieldNameConflict2", REQUIRED,
+                   "{\n \"jsonConflict\": \"hello\"\n}",
+                   R"pb(
+                     json_field_conflict2: "hello"
+                   )pb");
+  RunValidJsonTest(
+      "FieldNameConflictBoth", REQUIRED, "{\n \"jsonConflict\": \"hello\"\n}",
+      R"pb(
+        json_field_conflict1: "hello" json_field_conflict2: "hello"
+      )pb");
   // Missing comma between key/value pairs.
   ExpectParseFailureForJson(
       "MissingCommaOneLine", RECOMMENDED,
diff --git a/src/google/protobuf/test_messages_proto2.proto b/src/google/protobuf/test_messages_proto2.proto
index 1cc7c86..67a19dd 100644
--- a/src/google/protobuf/test_messages_proto2.proto
+++ b/src/google/protobuf/test_messages_proto2.proto
@@ -233,6 +233,9 @@
   optional int32 field_name17__ = 417;
   optional int32 Field_name18__ = 418;
 
+  optional string json_field_conflict1 = 419 [json_name = "jsonConflict"];
+  optional string json_field_conflict2 = 420 [json_name = "jsonConflict"];
+
   // Reserved for unknown fields test.
   reserved 1000 to 9999;
 
diff --git a/src/google/protobuf/test_messages_proto3.proto b/src/google/protobuf/test_messages_proto3.proto
index 1e1285e..9144e2c 100644
--- a/src/google/protobuf/test_messages_proto3.proto
+++ b/src/google/protobuf/test_messages_proto3.proto
@@ -264,6 +264,9 @@
   int32 field_name17__ = 417;
   int32 Field_name18__ = 418;
 
+  optional string json_field_conflict1 = 419 [json_name = "jsonConflict"];
+  optional string json_field_conflict2 = 420 [json_name = "jsonConflict"];
+
   // Reserved for testing unknown fields
   reserved 501 to 510;
 }