com.google.protobuf
protobuf-java-util
3.22.2
package com.ub;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Message;
import com.google.protobuf.util.JsonFormat;
public class TestProto2 {
public static void main(String[] args) throws Exception {
UserInfo userInfo = UserInfo.newBuilder().setExtra("extra info")
.putHealthMap("height",178)
.putHealthMap("weight",70)
.build();
String tmp = JsonFormat.printer().print(userInfo);
UserInfo.Builder message = UserInfo.newBuilder();
JsonFormat.parser().merge(tmp,message);
System.out.println(message.build().getExtra());
}
}
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net