Class JsonToProtoMessage (2.39.0)

public class JsonToProtoMessage

Converts Json data to protocol buffer messages given the protocol buffer descriptor. The protobuf descriptor must have all fields lowercased.

Inheritance

java.lang.Object > JsonToProtoMessage

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
NameDescription
protoSchemaDescriptor
tableSchemaTableSchema

bigquery table schema is needed for type conversion of DATETIME, TIME, NUMERIC, BIGNUMERIC

jsonorg.json.JSONObject
Returns
TypeDescription
DynamicMessage
Exceptions
TypeDescription
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
NameDescription
protoSchemaDescriptor
jsonorg.json.JSONObject
Returns
TypeDescription
DynamicMessage
Exceptions
TypeDescription
IllegalArgumentException

when JSON data is not compatible with proto descriptor.

Constructors

JsonToProtoMessage()

public JsonToProtoMessage()