Package com.google.protobuf.util
Class JsonFormat.Parser
java.lang.Object
com.google.protobuf.util.JsonFormat.Parser
- Enclosing class:
JsonFormat
A Parser parses the proto3 JSON format into a protobuf message.
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newJsonFormat.Parser
configured to not throw an exception when an unknown field is encountered.void
merge
(Reader json, Message.Builder builder) Parses from the proto3 JSON encoding into a protobuf message.void
merge
(String json, Message.Builder builder) Parses from the proto3 JSON format into a protobuf message.usingTypeRegistry
(TypeRegistry registry) Creates a newJsonFormat.Parser
using the given registry.usingTypeRegistry
(JsonFormat.TypeRegistry oldRegistry) Creates a newJsonFormat.Parser
using the given registry.
-
Method Details
-
usingTypeRegistry
Creates a newJsonFormat.Parser
using the given registry. The new Parser clones all other configurations from this Parser.- Throws:
IllegalArgumentException
- if a registry is already set
-
usingTypeRegistry
Creates a newJsonFormat.Parser
using the given registry. The new Parser clones all other configurations from this Parser.- Throws:
IllegalArgumentException
- if a registry is already set
-
ignoringUnknownFields
Creates a newJsonFormat.Parser
configured to not throw an exception when an unknown field is encountered. The new Parser clones all other configurations from this Parser. -
merge
public void merge(String json, Message.Builder builder) throws com.google.protobuf.InvalidProtocolBufferException Parses from the proto3 JSON format into a protobuf message.- Throws:
com.google.protobuf.InvalidProtocolBufferException
- if the input is not valid JSON proto3 format or there are unknown fields in the input.
-
merge
Parses from the proto3 JSON encoding into a protobuf message.- Throws:
com.google.protobuf.InvalidProtocolBufferException
- if the input is not valid proto3 JSON format or there are unknown fields in the inputIOException
- if reading from the input throws
-