func (x *RxMetadata) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if true {  
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("gateway_ids")
		gogo.MarshalMessage(s, &x.GatewayIdentifiers)
	}
	if x.PacketBroker != nil || s.HasField("packet_broker") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("packet_broker")
		gogo.MarshalMessage(s, x.PacketBroker)
	}
	if x.AntennaIndex != 0 || s.HasField("antenna_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("antenna_index")
		s.WriteUint32(x.AntennaIndex)
	}
	if x.Time != nil || s.HasField("time") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("time")
		if x.Time == nil {
			s.WriteNil()
		} else {
			s.WriteTime(*x.Time)
		}
	}
	if x.Timestamp != 0 || s.HasField("timestamp") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("timestamp")
		s.WriteUint32(x.Timestamp)
	}
	if x.FineTimestamp != 0 || s.HasField("fine_timestamp") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("fine_timestamp")
		s.WriteUint64(x.FineTimestamp)
	}
	if len(x.EncryptedFineTimestamp) > 0 || s.HasField("encrypted_fine_timestamp") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("encrypted_fine_timestamp")
		s.WriteBytes(x.EncryptedFineTimestamp)
	}
	if x.EncryptedFineTimestampKeyId != "" || s.HasField("encrypted_fine_timestamp_key_id") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("encrypted_fine_timestamp_key_id")
		s.WriteString(x.EncryptedFineTimestampKeyId)
	}
	if x.Rssi != 0 || s.HasField("rssi") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rssi")
		s.WriteFloat32(x.Rssi)
	}
	if x.SignalRssi != nil || s.HasField("signal_rssi") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("signal_rssi")
		if x.SignalRssi == nil {
			s.WriteNil()
		} else {
			s.WriteFloat32(x.SignalRssi.Value)
		}
	}
	if x.ChannelRssi != 0 || s.HasField("channel_rssi") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("channel_rssi")
		s.WriteFloat32(x.ChannelRssi)
	}
	if x.RssiStandardDeviation != 0 || s.HasField("rssi_standard_deviation") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rssi_standard_deviation")
		s.WriteFloat32(x.RssiStandardDeviation)
	}
	if x.Snr != 0 || s.HasField("snr") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("snr")
		s.WriteFloat32(x.Snr)
	}
	if x.FrequencyOffset != 0 || s.HasField("frequency_offset") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("frequency_offset")
		s.WriteInt64(x.FrequencyOffset)
	}
	if x.Location != nil || s.HasField("location") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("location")
		x.Location.MarshalProtoJSON(s.WithField("location"))
	}
	if x.DownlinkPathConstraint != 0 || s.HasField("downlink_path_constraint") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("downlink_path_constraint")
		x.DownlinkPathConstraint.MarshalProtoJSON(s)
	}
	if len(x.UplinkToken) > 0 || s.HasField("uplink_token") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("uplink_token")
		s.WriteBytes(x.UplinkToken)
	}
	if x.ChannelIndex != 0 || s.HasField("channel_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("channel_index")
		s.WriteUint32(x.ChannelIndex)
	}
	if x.HoppingWidth != 0 || s.HasField("hopping_width") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("hopping_width")
		s.WriteUint32(x.HoppingWidth)
	}
	if x.FrequencyDrift != 0 || s.HasField("frequency_drift") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("frequency_drift")
		s.WriteInt32(x.FrequencyDrift)
	}
	if x.Advanced != nil || s.HasField("advanced") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("advanced")
		if x.Advanced == nil {
			s.WriteNil()
		} else {
			gogo.MarshalStruct(s, x.Advanced)
		}
	}
	s.WriteObjectEnd()
}
MarshalProtoJSON marshals the RxMetadata message to JSON.
package ttnpb
import (
	gogo "github.com/TheThingsIndustries/protoc-gen-go-json/gogo"
	jsonplugin "github.com/TheThingsIndustries/protoc-gen-go-json/jsonplugin"
	types "github.com/gogo/protobuf/types"
)
func (x LocationSource) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), LocationSource_name)
}
var LocationSource_customvalue = map[string]int32{
	"UNKNOWN":               0,
	"GPS":                   1,
	"REGISTRY":              3,
	"IP_GEOLOCATION":        4,
	"WIFI_RSSI_GEOLOCATION": 5,
	"BT_RSSI_GEOLOCATION":   6,
	"LORA_RSSI_GEOLOCATION": 7,
	"LORA_TDOA_GEOLOCATION": 8,
	"COMBINED_GEOLOCATION":  9,
}
func (x *LocationSource) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(LocationSource_value, LocationSource_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read LocationSource enum: %v", err)
		return
	}
	*x = LocationSource(v)
}