title: How to unpack an google.protobuf.Any type in gRPC nodejs client?
body: <p>My protobuf file is like this:</p>
  
  <pre><code>syntax = "proto3"; import "google/protobuf/any.proto";
  
  service RoomService {
      getTestAny (Hotelid) returns (google.protobuf.Any); }
  
  message Hotelid {
      string hotelid = 1; 
  } 
  
  message HtlInDate {
      Hotelid hotelid = 1;
      string date = 2; 
  }
  </code></pre>
  
  <p>My java-gRPC-server code is like that:</p>
  
  <pre><code>@Override
  public void getTestAny(Roomservice.Hotelid request, StreamObserver&lt;Any&gt; responseObserver) {
  
      Roomservice.Hotelid hotelid = Roomservice.Hotelid.newBuilder()
                                               .setHotelid("This is Hotelid")
                                               .build();
  
      Roomservice.HtlInDate htlDate = Roomservice.HtlInDate.newBuilder()
                                                 .setHotelid(hotelid)
                                                 .setDate("This is Data")
                                                 .build();
  
      responseObserver.onNext(Any.pack(htlDate));
      responseObserver.onCompleted();
  }
  </code></pre>
  
  <p>And I make a request from a nodejs-gRPC-client, which code is like that:</p>
  
  <pre><code>function () {
      var client = new services.RoomServiceClient('localhost:6565',
          grpc.credentials.createInsecure());
  
      var request = new messages.Hotelid();
      var hotelid = "ignore";
  
      request.setHotelid(hotelid);
  
      var call = client.getTestAny(request, function (err, response) {
  
          var obj = response.toObject();
  
          console.log(obj);
      });
  }
  </code></pre>
  
  <p>The response in nodejs-gRPC-client is a type of Any. And it contains a data array:</p>
  
  <pre><code>array:["type.googleapis.com/HtlInDate", Uint8Array[10,17,10...]]
  </code></pre>
  
  <p>I try to use <code>response.toObject()</code> to get HtlInDate instance but I just get like this:</p>
  
  <pre><code>obj:{
     typeUrl:"type.googleapis.com/HtlInDate",
     value:"ChEKD1RoaXMgaXMgSG90ZWxpZBIMVGhpcyBpcyBEYXRh"
  }</code></pre>
  
  <blockquote>
    <p>So how can I unpack the Any type response and get the HtlInDate instance exactly?   Thanks a lot if you have any idea about this!</p>
  </blockquote>