code: def encode_field(self, field, value):
      
      # Override the handling of 64-bit integers, so they're always encoded
      # as strings.
      if (isinstance(field, messages.IntegerField) and
          field.variant in (messages.Variant.INT64,
                            messages.Variant.UINT64,
                            messages.Variant.SINT64)):
        if value not in (None, [], ()):
          # Convert and replace the value.
          if isinstance(value, list):
            value = [str(subvalue) for subvalue in value]
          else:
            value = str(value)
          return value
  
      return super(EndpointsProtoJson, self).encode_field(field, value)
docs: Encode a python field value to a JSON value.
  
      Args:
        field: A ProtoRPC field instance.
        value: A python value supported by field.
  
      Returns:
        A JSON serializable value appropriate for field.