1

Here is how I have defined a message:

message PhoneNumberAndTypes {
  repeated Type types = 1;
  Phone number = 2;
}

And when I added the types using .addTypes() and printed the object in console, it came out like below:

phone_numbers {
  types: HOME
  types: MOBILE
  phone_number {
    number: "9912300000"
  }
}

But I hoped for the types to be like [HOME,MOBILE].

What change should I make?

xploreraj
  • 3,792
  • 12
  • 33
  • 51
  • 1
    "and printed the object in console," - this seems like simply how the console print is working; and how *that* works is implementation specific - yet you haven't told us what implementation (library, framework, language, etc) you are using – Marc Gravell Oct 19 '21 at 15:26
  • I agree. I think its just the printing part. Actually its a List inside while I debugged it. – xploreraj Oct 19 '21 at 15:28

1 Answers1

0

Actually its a List inside while I debugged it. The "printing" on console did not necessarily reflect the actual object properties.

[HOME, MOBILE]
xploreraj
  • 3,792
  • 12
  • 33
  • 51