class_docstr: JSON format parser for protocol message.
docstr: Convert field value pairs into regular message.
  
  Args:
    js: A JSON object to convert the field value pairs.
    message: A regular protocol message to record the data.
  
  Raises:
    ParseError: In case of problems converting.
docstr_tok: ["Convert","field","value","pairs","into","regular","message",".","Args",":","js",":","A","JSON","object","to","convert","the","field","value","pairs",".","message",":","A","regular","protocol","message","to","record","the","data",".","Raises",":","ParseError",":","In","case","of","problems","converting","."]
code: def _ConvertFieldValuePair(self, js, message):
      """Convert field value pairs into regular message.
  
      Args:
        js: A JSON object to convert the field value pairs.
        message: A regular protocol message to record the data.
  
      Raises:
        ParseError: In case of problems converting.
      """
      names = []
      message_descriptor = message.DESCRIPTOR
      fields_by_json_name = dict(
          (f.json_name, f) for f in message_descriptor.fields
      )
      for name in js:
          try:
              field = fields_by_json_name.get(name, None)
              if not field:
                  field = message_descriptor.fields_by_name.get(
                      name, None
                  )
              if not field and _VALID_EXTENSION_NAME.match(name):
                  if not message_descriptor.is_extendable:
                      raise ParseError(
                          "Message type {0} does not have extensions".format(
                              message_descriptor.full_name
                          )
                      )
                  identifier = name[1:-1]  # strip [] brackets
                  # pylint: disable=protected-access
                  field = message.Extensions._FindExtensionByName(
                      identifier
                  )
                  # pylint: enable=protected-access
                  if not field:
                      # Try looking for extension by the message type name, dropping the
                      # field name following the final . separator in full_name.
                      identifier = ".".join(identifier.split(".")[:-1])
                      # pylint: disable=protected-access
                      field = message.Extensions._FindExtensionByName(
                          identifier
                      )
                      # pylint: enable=protected-access
              if not field:
                  if self.ignore_unknown_fields:
                      continue
                  raise ParseError(
                      (
                          'Message type "{0}" has no field named "{1}".\n'
                          " Available Fields(except extensions): {2}"
                      ).format(
                          message_descriptor.full_name,
                          name,
                          [
                              f.json_name
                              for f in message_descriptor.fields
                          ],
                      )
                  )
              if name in names:
                  raise ParseError(
                      'Message type "{0}" should not have multiple '
                      '"{1}" fields.'.format(
                          message.DESCRIPTOR.full_name, name
                      )
                  )
              names.append(name)
              value = js[name]
              # Check no other oneof field is parsed.
              if (
                  field.containing_oneof is not None
                  and value is not None
              ):
                  oneof_name = field.containing_oneof.name
                  if oneof_name in names:
                      raise ParseError(
                          'Message type "{0}" should not have multiple '
                          '"{1}" oneof fields.'.format(
                              message.DESCRIPTOR.full_name, oneof_name
                          )
                      )
                  names.append(oneof_name)
  
              if value is None:
                  if (
                      field.cpp_type
                      == descriptor.FieldDescriptor.CPPTYPE_MESSAGE
                      and field.message_type.full_name
                      == "google.protobuf.Value"
                  ):
                      sub_message = getattr(message, field.name)
                      sub_message.null_value = 0
                  elif (
                      field.cpp_type
                      == descriptor.FieldDescriptor.CPPTYPE_ENUM
                      and field.enum_type.full_name
                      == "google.protobuf.NullValue"
                  ):
                      setattr(message, field.name, 0)
                  else:
                      message.ClearField(field.name)
                  continue
  
              # Parse field value.
              if _IsMapEntry(field):
                  message.ClearField(field.name)
                  self._ConvertMapFieldValue(value, message, field)
              elif (
                  field.label
                  == descriptor.FieldDescriptor.LABEL_REPEATED
              ):
                  message.ClearField(field.name)
                  if not isinstance(value, list):
                      raise ParseError(
                          "repeated field {0} must be in [] which is "
                          "{1}.".format(name, value)
                      )
                  if (
                      field.cpp_type
                      == descriptor.FieldDescriptor.CPPTYPE_MESSAGE
                  ):
                      # Repeated message field.
                      for item in value:
                          sub_message = getattr(
                              message, field.name
                          ).add()
                          # None is a null_value in Value.
                          if (
                              item is None
                              and sub_message.DESCRIPTOR.full_name
                              != "google.protobuf.Value"
                          ):
                              raise ParseError(
                                  "null is not allowed to be used as an element"
                                  " in a repeated field."
                              )
                          self.ConvertMessage(item, sub_message)
                  else:
                      # Repeated scalar field.
                      for item in value:
                          if item is None:
                              raise ParseError(
                                  "null is not allowed to be used as an element"
                                  " in a repeated field."
                              )
                          getattr(message, field.name).append(
                              _ConvertScalarFieldValue(item, field)
                          )
              elif (
                  field.cpp_type
                  == descriptor.FieldDescriptor.CPPTYPE_MESSAGE
              ):
                  if field.is_extension:
                      sub_message = message.Extensions[field]
                  else:
                      sub_message = getattr(message, field.name)
                  sub_message.SetInParent()
                  self.ConvertMessage(value, sub_message)
              else:
                  if field.is_extension:
                      message.Extensions[
                          field
                      ] = _ConvertScalarFieldValue(value, field)
                  else:
                      setattr(
                          message,
                          field.name,
                          _ConvertScalarFieldValue(value, field),
                      )
          except ParseError as e:
              if field and field.containing_oneof is None:
                  raise ParseError(
                      "Failed to parse {0} field: {1}.".format(name, e)
                  )
              else:
                  raise ParseError(str(e))
          except ValueError as e:
              raise ParseError(
                  "Failed to parse {0} field: {1}.".format(name, e)
              )
          except TypeError as e:
              raise ParseError(
                  "Failed to parse {0} field: {1}.".format(name, e)
              )
  
imports: import base64
  import json
  import math
  from operator import methodcaller
  import re
  import sys
  import six
  from google.protobuf.internal import type_checkers
  from google.protobuf import descriptor
  from google.protobuf import symbol_database
label_desc: Use image node_id 3 for calling the _Parser obj's underlying member method code with example usage: obj._ConvertFieldValuePair(js, message) without return types