diff --git a/ruby/tests/encode_decode_test.rb b/ruby/tests/encode_decode_test.rb index cce364d0d8..429ac43322 100755 --- a/ruby/tests/encode_decode_test.rb +++ b/ruby/tests/encode_decode_test.rb @@ -95,4 +95,10 @@ class EncodeDecodeTest < Test::Unit::TestCase end end + def test_json_name + msg = A::B::C::TestJsonName.new(:value => 42) + json = msg.to_json + assert_match json, "{\"CustomJsonName\":42}" + end + end diff --git a/ruby/tests/generated_code.proto b/ruby/tests/generated_code.proto index e8116697d7..bfdfa5aa78 100644 --- a/ruby/tests/generated_code.proto +++ b/ruby/tests/generated_code.proto @@ -83,3 +83,7 @@ message TestUnknown { map map_unknown = 67; int32 unknown_field = 89; } + +message TestJsonName { + int32 value = 1 [json_name = "CustomJsonName"]; +}