class_docstr: JSON format printer for protocol message.
docstr: Converts field value according to Proto3 JSON Specification.
docstr_tok: ["Converts","field","value","according","to","Proto3","JSON","Specification","."]
code: def _FieldToJsonObject(self, field, value):
      """Converts field value according to Proto3 JSON Specification."""
      if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
          return self._MessageToJsonObject(value)
      elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
          if self.use_integers_for_enums:
              return value
          if field.enum_type.full_name == "google.protobuf.NullValue":
              return None
          enum_value = field.enum_type.values_by_number.get(value, None)
          if enum_value is not None:
              return enum_value.name
          else:
              if field.file.syntax == "proto3":
                  return value
              raise SerializeToJsonError(
                  "Enum field contains an integer value "
                  "which can not mapped to an enum value."
              )
      elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING:
          if field.type == descriptor.FieldDescriptor.TYPE_BYTES:
              # Use base64 Data encoding for bytes
              return base64.b64encode(value).decode("utf-8")
          else:
              return value
      elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_BOOL:
          return bool(value)
      elif field.cpp_type in _INT64_TYPES:
          return str(value)
      elif field.cpp_type in _FLOAT_TYPES:
          if math.isinf(value):
              if value < 0.0:
                  return _NEG_INFINITY
              else:
                  return _INFINITY
          if math.isnan(value):
              return _NAN
          if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_FLOAT:
              if self.float_format:
                  return float(format(value, self.float_format))
              else:
                  return type_checkers.ToShortestFloat(value)
  
      return value
  
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 5 for calling the _Printer obj's underlying member method code with example usage: obj._FieldToJsonObject(field, value) and returns: value, self, value, None, enum_value, value, base64, value, bool, str, _NAN, _NEG_INFINITY, _INFINITY, float, type_checkers