(1) test.proto file:
message test {
optional int32 a1 =1;
optional int32 a2 =2;
}
(2) python file:
from google.protobuf import json_format
json_obj='{"a1":1,"a2":2}'
// json to pb
request = json_format.Parse(json_obj,test_pb2.test())
//pb to json
json_result = json_format.MessageToJson(request)