Class JsonFormat.Parser

  • Enclosing class:
    JsonFormat

    public static class JsonFormat.Parser
    extends Object
    A Parser parses the proto3 JSON format into a protobuf message.
    • Method Detail

      • usingTypeRegistry

        public JsonFormat.Parser usingTypeRegistry​(com.google.protobuf.TypeRegistry registry)
        Creates a new JsonFormat.Parser using the given registry. The new Parser clones all other configurations from this Parser.
        Throws:
        IllegalArgumentException - if a registry is already set
      • ignoringUnknownFields

        public JsonFormat.Parser ignoringUnknownFields()
        Creates a new JsonFormat.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,
                          com.google.protobuf.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

        public void merge​(Reader json,
                          com.google.protobuf.Message.Builder builder)
                   throws IOException
        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 input
        IOException - if reading from the input throws