Class JsonFormat.Parser (3.19.4)

public static class JsonFormat.Parser

A Parser parses JSON to protobuf message.

Inheritance

java.lang.Object > JsonFormat.Parser

Methods

ignoringUnknownFields()

public JsonFormat.Parser ignoringUnknownFields()

Creates a new Parser configured to not throw an exception when an unknown field is encountered. The new Parser clones all other configurations from this Parser.

Returns
TypeDescription
JsonFormat.Parser

merge(Reader json, Message.Builder builder)

public void merge(Reader json, Message.Builder builder)

Parses from JSON into a protobuf message.

Parameters
NameDescription
jsonReader
builderMessage.Builder
Exceptions
TypeDescription
IOException

if the input is not valid JSON format or there are unknown fields in the input.

merge(String json, Message.Builder builder)

public void merge(String json, Message.Builder builder)

Parses from JSON into a protobuf message.

Parameters
NameDescription
jsonString
builderMessage.Builder
Exceptions
TypeDescription
InvalidProtocolBufferException

if the input is not valid JSON format or there are unknown fields in the input.

usingTypeRegistry(TypeRegistry registry)

public JsonFormat.Parser usingTypeRegistry(TypeRegistry registry)

Creates a new Parser using the given registry. The new Parser clones all other configurations from this Parser.

Parameter
NameDescription
registryTypeRegistry
Returns
TypeDescription
JsonFormat.Parser

usingTypeRegistry(JsonFormat.TypeRegistry oldRegistry)

public JsonFormat.Parser usingTypeRegistry(JsonFormat.TypeRegistry oldRegistry)

Creates a new Parser using the given registry. The new Parser clones all other configurations from this Parser.

Parameter
NameDescription
oldRegistryJsonFormat.TypeRegistry
Returns
TypeDescription
JsonFormat.Parser