public class JsonToProtoMessage
Converts Json data to protocol buffer messages given the protocol buffer descriptor. The protobuf descriptor must have all fields lowercased.
Static Methods
convertJsonToProtoMessage(Descriptors.Descriptor protoSchema, TableSchema tableSchema, JSONObject json)
public static DynamicMessage convertJsonToProtoMessage(Descriptors.Descriptor protoSchema, TableSchema tableSchema, JSONObject json)
Converts Json data to protocol buffer messages given the protocol buffer descriptor.
Parameters | |
---|---|
Name | Description |
protoSchema | Descriptor |
tableSchema | TableSchema bigquery table schema is needed for type conversion of DATETIME, TIME, NUMERIC, BIGNUMERIC |
json | org.json.JSONObject |
Returns | |
---|---|
Type | Description |
DynamicMessage |
Exceptions | |
---|---|
Type | Description |
IllegalArgumentException | when JSON data is not compatible with proto descriptor. |
convertJsonToProtoMessage(Descriptors.Descriptor protoSchema, JSONObject json)
public static DynamicMessage convertJsonToProtoMessage(Descriptors.Descriptor protoSchema, JSONObject json)
Converts Json data to protocol buffer messages given the protocol buffer descriptor.
Parameters | |
---|---|
Name | Description |
protoSchema | Descriptor |
json | org.json.JSONObject |
Returns | |
---|---|
Type | Description |
DynamicMessage |
Exceptions | |
---|---|
Type | Description |
IllegalArgumentException | when JSON data is not compatible with proto descriptor. |
Constructors
JsonToProtoMessage()
public JsonToProtoMessage()