class_docstr: JSON format printer for protocol message.
docstr: Converts normal message according to Proto3 JSON Specification.
docstr_tok: ["Converts","normal","message","according","to","Proto3","JSON","Specification","."]
code: def _RegularMessageToJsonObject(self, message, js):
      """Converts normal message according to Proto3 JSON Specification."""
      fields = message.ListFields()
  
      try:
          for field, value in fields:
              if self.preserving_proto_field_name:
                  name = field.name
              else:
                  name = field.json_name
              if _IsMapEntry(field):
                  # Convert a map field.
                  v_field = field.message_type.fields_by_name["value"]
                  js_map = {}
                  for key in value:
                      if isinstance(key, bool):
                          if key:
                              recorded_key = "true"
                          else:
                              recorded_key = "false"
                      else:
                          recorded_key = key
                      js_map[recorded_key] = self._FieldToJsonObject(
                          v_field, value[key]
                      )
                  js[name] = js_map
              elif (
                  field.label
                  == descriptor.FieldDescriptor.LABEL_REPEATED
              ):
                  # Convert a repeated field.
                  js[name] = [
                      self._FieldToJsonObject(field, k) for k in value
                  ]
              elif field.is_extension:
                  name = "[%s]" % field.full_name
                  js[name] = self._FieldToJsonObject(field, value)
              else:
                  js[name] = self._FieldToJsonObject(field, value)
  
          # Serialize default value if including_default_value_fields is True.
          if self.including_default_value_fields:
              message_descriptor = message.DESCRIPTOR
              for field in message_descriptor.fields:
                  # Singular message fields and oneof fields will not be affected.
                  if (
                      field.label
                      != descriptor.FieldDescriptor.LABEL_REPEATED
                      and field.cpp_type
                      == descriptor.FieldDescriptor.CPPTYPE_MESSAGE
                  ) or field.containing_oneof:
                      continue
                  if self.preserving_proto_field_name:
                      name = field.name
                  else:
                      name = field.json_name
                  if name in js:
                      # Skip the field which has been serialized already.
                      continue
                  if _IsMapEntry(field):
                      js[name] = {}
                  elif (
                      field.label
                      == descriptor.FieldDescriptor.LABEL_REPEATED
                  ):
                      js[name] = []
                  else:
                      js[name] = self._FieldToJsonObject(
                          field, field.default_value
                      )
  
      except ValueError as e:
          raise SerializeToJsonError(
              "Failed to serialize {0} field: {1}.".format(
                  field.name, e
              )
          )
  
      return js
  
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 4 for calling the _Printer obj's underlying member method code with example usage: obj._RegularMessageToJsonObject(message, js) and returns: js