func (x *MACSettings) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.ClassBTimeout != nil || s.HasField("class_b_timeout") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("class_b_timeout")
		if x.ClassBTimeout == nil {
			s.WriteNil()
		} else {
			s.WriteDuration(*x.ClassBTimeout)
		}
	}
	if x.PingSlotPeriodicity != nil || s.HasField("ping_slot_periodicity") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("ping_slot_periodicity")
		x.PingSlotPeriodicity.MarshalProtoJSON(s.WithField("ping_slot_periodicity"))
	}
	if x.PingSlotDataRateIndex != nil || s.HasField("ping_slot_data_rate_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("ping_slot_data_rate_index")
		x.PingSlotDataRateIndex.MarshalProtoJSON(s.WithField("ping_slot_data_rate_index"))
	}
	if x.PingSlotFrequency != nil || s.HasField("ping_slot_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("ping_slot_frequency")
		x.PingSlotFrequency.MarshalProtoJSON(s.WithField("ping_slot_frequency"))
	}
	if x.BeaconFrequency != nil || s.HasField("beacon_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("beacon_frequency")
		x.BeaconFrequency.MarshalProtoJSON(s.WithField("beacon_frequency"))
	}
	if x.ClassCTimeout != nil || s.HasField("class_c_timeout") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("class_c_timeout")
		if x.ClassCTimeout == nil {
			s.WriteNil()
		} else {
			s.WriteDuration(*x.ClassCTimeout)
		}
	}
	if x.Rx1Delay != nil || s.HasField("rx1_delay") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rx1_delay")
		x.Rx1Delay.MarshalProtoJSON(s.WithField("rx1_delay"))
	}
	if x.Rx1DataRateOffset != nil || s.HasField("rx1_data_rate_offset") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rx1_data_rate_offset")
		x.Rx1DataRateOffset.MarshalProtoJSON(s.WithField("rx1_data_rate_offset"))
	}
	if x.Rx2DataRateIndex != nil || s.HasField("rx2_data_rate_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rx2_data_rate_index")
		x.Rx2DataRateIndex.MarshalProtoJSON(s.WithField("rx2_data_rate_index"))
	}
	if x.Rx2Frequency != nil || s.HasField("rx2_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rx2_frequency")
		x.Rx2Frequency.MarshalProtoJSON(s.WithField("rx2_frequency"))
	}
	if len(x.FactoryPresetFrequencies) > 0 || s.HasField("factory_preset_frequencies") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("factory_preset_frequencies")
		s.WriteUint64Array(x.FactoryPresetFrequencies)
	}
	if x.MaxDutyCycle != nil || s.HasField("max_duty_cycle") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("max_duty_cycle")
		x.MaxDutyCycle.MarshalProtoJSON(s.WithField("max_duty_cycle"))
	}
	if x.Supports_32BitFCnt != nil || s.HasField("supports_32_bit_f_cnt") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("supports_32_bit_f_cnt")
		x.Supports_32BitFCnt.MarshalProtoJSON(s.WithField("supports_32_bit_f_cnt"))
	}
	if x.UseAdr != nil || s.HasField("use_adr") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("use_adr")
		x.UseAdr.MarshalProtoJSON(s.WithField("use_adr"))
	}
	if x.AdrMargin != nil || s.HasField("adr_margin") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("adr_margin")
		if x.AdrMargin == nil {
			s.WriteNil()
		} else {
			s.WriteFloat32(x.AdrMargin.Value)
		}
	}
	if x.ResetsFCnt != nil || s.HasField("resets_f_cnt") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("resets_f_cnt")
		x.ResetsFCnt.MarshalProtoJSON(s.WithField("resets_f_cnt"))
	}
	if x.StatusTimePeriodicity != nil || s.HasField("status_time_periodicity") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("status_time_periodicity")
		if x.StatusTimePeriodicity == nil {
			s.WriteNil()
		} else {
			s.WriteDuration(*x.StatusTimePeriodicity)
		}
	}
	if x.StatusCountPeriodicity != nil || s.HasField("status_count_periodicity") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("status_count_periodicity")
		if x.StatusCountPeriodicity == nil {
			s.WriteNil()
		} else {
			s.WriteUint32(x.StatusCountPeriodicity.Value)
		}
	}
	if x.DesiredRx1Delay != nil || s.HasField("desired_rx1_delay") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_rx1_delay")
		x.DesiredRx1Delay.MarshalProtoJSON(s.WithField("desired_rx1_delay"))
	}
	if x.DesiredRx1DataRateOffset != nil || s.HasField("desired_rx1_data_rate_offset") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_rx1_data_rate_offset")
		x.DesiredRx1DataRateOffset.MarshalProtoJSON(s.WithField("desired_rx1_data_rate_offset"))
	}
	if x.DesiredRx2DataRateIndex != nil || s.HasField("desired_rx2_data_rate_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_rx2_data_rate_index")
		x.DesiredRx2DataRateIndex.MarshalProtoJSON(s.WithField("desired_rx2_data_rate_index"))
	}
	if x.DesiredRx2Frequency != nil || s.HasField("desired_rx2_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_rx2_frequency")
		x.DesiredRx2Frequency.MarshalProtoJSON(s.WithField("desired_rx2_frequency"))
	}
	if x.DesiredMaxDutyCycle != nil || s.HasField("desired_max_duty_cycle") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_max_duty_cycle")
		x.DesiredMaxDutyCycle.MarshalProtoJSON(s.WithField("desired_max_duty_cycle"))
	}
	if x.DesiredAdrAckLimitExponent != nil || s.HasField("desired_adr_ack_limit_exponent") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_adr_ack_limit_exponent")
		x.DesiredAdrAckLimitExponent.MarshalProtoJSON(s.WithField("desired_adr_ack_limit_exponent"))
	}
	if x.DesiredAdrAckDelayExponent != nil || s.HasField("desired_adr_ack_delay_exponent") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_adr_ack_delay_exponent")
		x.DesiredAdrAckDelayExponent.MarshalProtoJSON(s.WithField("desired_adr_ack_delay_exponent"))
	}
	if x.DesiredPingSlotDataRateIndex != nil || s.HasField("desired_ping_slot_data_rate_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_ping_slot_data_rate_index")
		x.DesiredPingSlotDataRateIndex.MarshalProtoJSON(s.WithField("desired_ping_slot_data_rate_index"))
	}
	if x.DesiredPingSlotFrequency != nil || s.HasField("desired_ping_slot_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_ping_slot_frequency")
		x.DesiredPingSlotFrequency.MarshalProtoJSON(s.WithField("desired_ping_slot_frequency"))
	}
	if x.DesiredBeaconFrequency != nil || s.HasField("desired_beacon_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_beacon_frequency")
		x.DesiredBeaconFrequency.MarshalProtoJSON(s.WithField("desired_beacon_frequency"))
	}
	if x.DesiredMaxEirp != nil || s.HasField("desired_max_eirp") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("desired_max_eirp")
		x.DesiredMaxEirp.MarshalProtoJSON(s.WithField("desired_max_eirp"))
	}
	if x.ClassBCDownlinkInterval != nil || s.HasField("class_b_c_downlink_interval") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("class_b_c_downlink_interval")
		if x.ClassBCDownlinkInterval == nil {
			s.WriteNil()
		} else {
			s.WriteDuration(*x.ClassBCDownlinkInterval)
		}
	}
	s.WriteObjectEnd()
}
MarshalProtoJSON marshals the MACSettings 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"
	types1 "go.thethings.network/lorawan-stack/v3/pkg/types"
)
func (x PowerState) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), PowerState_name)
}
var PowerState_customvalue = map[string]int32{
	"UNKNOWN":  0,
	"BATTERY":  1,
	"EXTERNAL": 2,
}
func (x *PowerState) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(PowerState_value, PowerState_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read PowerState enum: %v", err)
		return
	}
	*x = PowerState(v)
}
func (x *Session) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if len(x.DevAddr) > 0 || s.HasField("dev_addr") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("dev_addr")
		x.DevAddr.MarshalProtoJSON(s.WithField("dev_addr"))
	}
	if true {  
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("keys")
		gogo.MarshalMessage(s, &x.SessionKeys)
	}
	if x.LastFCntUp != 0 || s.HasField("last_f_cnt_up") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("last_f_cnt_up")
		s.WriteUint32(x.LastFCntUp)
	}
	if x.LastNFCntDown != 0 || s.HasField("last_n_f_cnt_down") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("last_n_f_cnt_down")
		s.WriteUint32(x.LastNFCntDown)
	}
	if x.LastAFCntDown != 0 || s.HasField("last_a_f_cnt_down") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("last_a_f_cnt_down")
		s.WriteUint32(x.LastAFCntDown)
	}
	if x.LastConfFCntDown != 0 || s.HasField("last_conf_f_cnt_down") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("last_conf_f_cnt_down")
		s.WriteUint32(x.LastConfFCntDown)
	}
	if true {  
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("started_at")
		s.WriteTime(x.StartedAt)
	}
	if len(x.QueuedApplicationDownlinks) > 0 || s.HasField("queued_application_downlinks") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("queued_application_downlinks")
		s.WriteArrayStart()
		var wroteElement bool
		for _, element := range x.QueuedApplicationDownlinks {
			s.WriteMoreIf(&wroteElement)
			element.MarshalProtoJSON(s.WithField("queued_application_downlinks"))
		}
		s.WriteArrayEnd()
	}
	s.WriteObjectEnd()
}
func (x *Session) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.ReadAny()  
		case "dev_addr", "devAddr":
			s.AddField("dev_addr")
			x.DevAddr.UnmarshalProtoJSON(s.WithField("dev_addr", false))
		case "keys":
			s.AddField("keys")
			var v SessionKeys
			gogo.UnmarshalMessage(s, &v)
			x.SessionKeys = v
		case "last_f_cnt_up", "lastFCntUp":
			s.AddField("last_f_cnt_up")
			x.LastFCntUp = s.ReadUint32()
		case "last_n_f_cnt_down", "lastNFCntDown":
			s.AddField("last_n_f_cnt_down")
			x.LastNFCntDown = s.ReadUint32()
		case "last_a_f_cnt_down", "lastAFCntDown":
			s.AddField("last_a_f_cnt_down")
			x.LastAFCntDown = s.ReadUint32()
		case "last_conf_f_cnt_down", "lastConfFCntDown":
			s.AddField("last_conf_f_cnt_down")
			x.LastConfFCntDown = s.ReadUint32()
		case "started_at", "startedAt":
			s.AddField("started_at")
			v := s.ReadTime()
			if s.Err() != nil {
				return
			}
			x.StartedAt = *v
		case "queued_application_downlinks", "queuedApplicationDownlinks":
			s.AddField("queued_application_downlinks")
			s.ReadArray(func() {
				if s.ReadNil() {
					x.QueuedApplicationDownlinks = append(x.QueuedApplicationDownlinks, nil)
					return
				}
				v := &ApplicationDownlink{}
				v.UnmarshalProtoJSON(s.WithField("queued_application_downlinks", false))
				if s.Err() != nil {
					return
				}
				x.QueuedApplicationDownlinks = append(x.QueuedApplicationDownlinks, v)
			})
		}
	})
}
func (x *BoolValue) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteBool(x.Value)
	return
}
func (x *BoolValue) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	x.Value = s.ReadBool()
	return
}
func (x *MACParameters_Channel) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.UplinkFrequency != 0 || s.HasField("uplink_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("uplink_frequency")
		s.WriteUint64(x.UplinkFrequency)
	}
	if x.DownlinkFrequency != 0 || s.HasField("downlink_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("downlink_frequency")
		s.WriteUint64(x.DownlinkFrequency)
	}
	if x.MinDataRateIndex != 0 || s.HasField("min_data_rate_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("min_data_rate_index")
		x.MinDataRateIndex.MarshalProtoJSON(s)
	}
	if x.MaxDataRateIndex != 0 || s.HasField("max_data_rate_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("max_data_rate_index")
		x.MaxDataRateIndex.MarshalProtoJSON(s)
	}
	if x.EnableUplink || s.HasField("enable_uplink") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("enable_uplink")
		s.WriteBool(x.EnableUplink)
	}
	s.WriteObjectEnd()
}
func (x *MACParameters_Channel) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.ReadAny()  
		case "uplink_frequency", "uplinkFrequency":
			s.AddField("uplink_frequency")
			x.UplinkFrequency = s.ReadUint64()
		case "downlink_frequency", "downlinkFrequency":
			s.AddField("downlink_frequency")
			x.DownlinkFrequency = s.ReadUint64()
		case "min_data_rate_index", "minDataRateIndex":
			s.AddField("min_data_rate_index")
			x.MinDataRateIndex.UnmarshalProtoJSON(s)
		case "max_data_rate_index", "maxDataRateIndex":
			s.AddField("max_data_rate_index")
			x.MaxDataRateIndex.UnmarshalProtoJSON(s)
		case "enable_uplink", "enableUplink":
			s.AddField("enable_uplink")
			x.EnableUplink = s.ReadBool()
		}
	})
}
func (x *MACParameters) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.MaxEirp != 0 || s.HasField("max_eirp") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("max_eirp")
		s.WriteFloat32(x.MaxEirp)
	}
	if x.AdrDataRateIndex != 0 || s.HasField("adr_data_rate_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("adr_data_rate_index")
		x.AdrDataRateIndex.MarshalProtoJSON(s)
	}
	if x.AdrTxPowerIndex != 0 || s.HasField("adr_tx_power_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("adr_tx_power_index")
		s.WriteUint32(x.AdrTxPowerIndex)
	}
	if x.AdrNbTrans != 0 || s.HasField("adr_nb_trans") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("adr_nb_trans")
		s.WriteUint32(x.AdrNbTrans)
	}
	if x.AdrAckLimit != 0 || s.HasField("adr_ack_limit") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("adr_ack_limit")
		s.WriteUint32(x.AdrAckLimit)
	}
	if x.AdrAckDelay != 0 || s.HasField("adr_ack_delay") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("adr_ack_delay")
		s.WriteUint32(x.AdrAckDelay)
	}
	if x.Rx1Delay != 0 || s.HasField("rx1_delay") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rx1_delay")
		x.Rx1Delay.MarshalProtoJSON(s)
	}
	if x.Rx1DataRateOffset != 0 || s.HasField("rx1_data_rate_offset") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rx1_data_rate_offset")
		x.Rx1DataRateOffset.MarshalProtoJSON(s)
	}
	if x.Rx2DataRateIndex != 0 || s.HasField("rx2_data_rate_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rx2_data_rate_index")
		x.Rx2DataRateIndex.MarshalProtoJSON(s)
	}
	if x.Rx2Frequency != 0 || s.HasField("rx2_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rx2_frequency")
		s.WriteUint64(x.Rx2Frequency)
	}
	if x.MaxDutyCycle != 0 || s.HasField("max_duty_cycle") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("max_duty_cycle")
		x.MaxDutyCycle.MarshalProtoJSON(s)
	}
	if x.RejoinTimePeriodicity != 0 || s.HasField("rejoin_time_periodicity") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rejoin_time_periodicity")
		x.RejoinTimePeriodicity.MarshalProtoJSON(s)
	}
	if x.RejoinCountPeriodicity != 0 || s.HasField("rejoin_count_periodicity") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("rejoin_count_periodicity")
		x.RejoinCountPeriodicity.MarshalProtoJSON(s)
	}
	if x.PingSlotFrequency != 0 || s.HasField("ping_slot_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("ping_slot_frequency")
		s.WriteUint64(x.PingSlotFrequency)
	}
	if x.PingSlotDataRateIndex != 0 || s.HasField("ping_slot_data_rate_index") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("ping_slot_data_rate_index")
		x.PingSlotDataRateIndex.MarshalProtoJSON(s)
	}
	if x.BeaconFrequency != 0 || s.HasField("beacon_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("beacon_frequency")
		s.WriteUint64(x.BeaconFrequency)
	}
	if len(x.Channels) > 0 || s.HasField("channels") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("channels")
		s.WriteArrayStart()
		var wroteElement bool
		for _, element := range x.Channels {
			s.WriteMoreIf(&wroteElement)
			element.MarshalProtoJSON(s.WithField("channels"))
		}
		s.WriteArrayEnd()
	}
	if x.UplinkDwellTime != nil || s.HasField("uplink_dwell_time") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("uplink_dwell_time")
		x.UplinkDwellTime.MarshalProtoJSON(s.WithField("uplink_dwell_time"))
	}
	if x.DownlinkDwellTime != nil || s.HasField("downlink_dwell_time") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("downlink_dwell_time")
		x.DownlinkDwellTime.MarshalProtoJSON(s.WithField("downlink_dwell_time"))
	}
	if x.AdrAckLimitExponent != nil || s.HasField("adr_ack_limit_exponent") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("adr_ack_limit_exponent")
		x.AdrAckLimitExponent.MarshalProtoJSON(s.WithField("adr_ack_limit_exponent"))
	}
	if x.AdrAckDelayExponent != nil || s.HasField("adr_ack_delay_exponent") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("adr_ack_delay_exponent")
		x.AdrAckDelayExponent.MarshalProtoJSON(s.WithField("adr_ack_delay_exponent"))
	}
	if x.PingSlotDataRateIndexValue != nil || s.HasField("ping_slot_data_rate_index_value") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("ping_slot_data_rate_index_value")
		x.PingSlotDataRateIndexValue.MarshalProtoJSON(s.WithField("ping_slot_data_rate_index_value"))
	}
	s.WriteObjectEnd()
}
func (x *MACParameters) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.ReadAny()  
		case "max_eirp", "maxEirp":
			s.AddField("max_eirp")
			x.MaxEirp = s.ReadFloat32()
		case "adr_data_rate_index", "adrDataRateIndex":
			s.AddField("adr_data_rate_index")
			x.AdrDataRateIndex.UnmarshalProtoJSON(s)
		case "adr_tx_power_index", "adrTxPowerIndex":
			s.AddField("adr_tx_power_index")
			x.AdrTxPowerIndex = s.ReadUint32()
		case "adr_nb_trans", "adrNbTrans":
			s.AddField("adr_nb_trans")
			x.AdrNbTrans = s.ReadUint32()
		case "adr_ack_limit", "adrAckLimit":
			s.AddField("adr_ack_limit")
			x.AdrAckLimit = s.ReadUint32()
		case "adr_ack_delay", "adrAckDelay":
			s.AddField("adr_ack_delay")
			x.AdrAckDelay = s.ReadUint32()
		case "rx1_delay", "rx1Delay":
			s.AddField("rx1_delay")
			x.Rx1Delay.UnmarshalProtoJSON(s)
		case "rx1_data_rate_offset", "rx1DataRateOffset":
			s.AddField("rx1_data_rate_offset")
			x.Rx1DataRateOffset.UnmarshalProtoJSON(s)
		case "rx2_data_rate_index", "rx2DataRateIndex":
			s.AddField("rx2_data_rate_index")
			x.Rx2DataRateIndex.UnmarshalProtoJSON(s)
		case "rx2_frequency", "rx2Frequency":
			s.AddField("rx2_frequency")
			x.Rx2Frequency = s.ReadUint64()
		case "max_duty_cycle", "maxDutyCycle":
			s.AddField("max_duty_cycle")
			x.MaxDutyCycle.UnmarshalProtoJSON(s)
		case "rejoin_time_periodicity", "rejoinTimePeriodicity":
			s.AddField("rejoin_time_periodicity")
			x.RejoinTimePeriodicity.UnmarshalProtoJSON(s)
		case "rejoin_count_periodicity", "rejoinCountPeriodicity":
			s.AddField("rejoin_count_periodicity")
			x.RejoinCountPeriodicity.UnmarshalProtoJSON(s)
		case "ping_slot_frequency", "pingSlotFrequency":
			s.AddField("ping_slot_frequency")
			x.PingSlotFrequency = s.ReadUint64()
		case "ping_slot_data_rate_index", "pingSlotDataRateIndex":
			s.AddField("ping_slot_data_rate_index")
			x.PingSlotDataRateIndex.UnmarshalProtoJSON(s)
		case "beacon_frequency", "beaconFrequency":
			s.AddField("beacon_frequency")
			x.BeaconFrequency = s.ReadUint64()
		case "channels":
			s.AddField("channels")
			s.ReadArray(func() {
				if s.ReadNil() {
					x.Channels = append(x.Channels, nil)
					return
				}
				v := &MACParameters_Channel{}
				v.UnmarshalProtoJSON(s.WithField("channels", false))
				if s.Err() != nil {
					return
				}
				x.Channels = append(x.Channels, v)
			})
		case "uplink_dwell_time", "uplinkDwellTime":
			s.AddField("uplink_dwell_time")
			if !s.ReadNil() {
				x.UplinkDwellTime = &BoolValue{}
				x.UplinkDwellTime.UnmarshalProtoJSON(s.WithField("uplink_dwell_time", false))
			}
		case "downlink_dwell_time", "downlinkDwellTime":
			s.AddField("downlink_dwell_time")
			if !s.ReadNil() {
				x.DownlinkDwellTime = &BoolValue{}
				x.DownlinkDwellTime.UnmarshalProtoJSON(s.WithField("downlink_dwell_time", false))
			}
		case "adr_ack_limit_exponent", "adrAckLimitExponent":
			s.AddField("adr_ack_limit_exponent")
			if !s.ReadNil() {
				x.AdrAckLimitExponent = &ADRAckLimitExponentValue{}
				x.AdrAckLimitExponent.UnmarshalProtoJSON(s.WithField("adr_ack_limit_exponent", false))
			}
		case "adr_ack_delay_exponent", "adrAckDelayExponent":
			s.AddField("adr_ack_delay_exponent")
			if !s.ReadNil() {
				x.AdrAckDelayExponent = &ADRAckDelayExponentValue{}
				x.AdrAckDelayExponent.UnmarshalProtoJSON(s.WithField("adr_ack_delay_exponent", false))
			}
		case "ping_slot_data_rate_index_value", "pingSlotDataRateIndexValue":
			s.AddField("ping_slot_data_rate_index_value")
			if !s.ReadNil() {
				x.PingSlotDataRateIndexValue = &DataRateIndexValue{}
				x.PingSlotDataRateIndexValue.UnmarshalProtoJSON(s.WithField("ping_slot_data_rate_index_value", false))
			}
		}
	})
}
func (x *EndDeviceVersion) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if true {  
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("ids")
		gogo.MarshalMessage(s, &x.EndDeviceVersionIdentifiers)
	}
	if x.LorawanVersion != 0 || s.HasField("lorawan_version") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("lorawan_version")
		x.LorawanVersion.MarshalProtoJSON(s)
	}
	if x.LorawanPhyVersion != 0 || s.HasField("lorawan_phy_version") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("lorawan_phy_version")
		x.LorawanPhyVersion.MarshalProtoJSON(s)
	}
	if x.FrequencyPlanId != "" || s.HasField("frequency_plan_id") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("frequency_plan_id")
		s.WriteString(x.FrequencyPlanId)
	}
	if len(x.Photos) > 0 || s.HasField("photos") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("photos")
		s.WriteStringArray(x.Photos)
	}
	if x.SupportsClassB || s.HasField("supports_class_b") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("supports_class_b")
		s.WriteBool(x.SupportsClassB)
	}
	if x.SupportsClassC || s.HasField("supports_class_c") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("supports_class_c")
		s.WriteBool(x.SupportsClassC)
	}
	if x.DefaultMacSettings != nil || s.HasField("default_mac_settings") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("default_mac_settings")
		x.DefaultMacSettings.MarshalProtoJSON(s.WithField("default_mac_settings"))
	}
	if x.MinFrequency != 0 || s.HasField("min_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("min_frequency")
		s.WriteUint64(x.MinFrequency)
	}
	if x.MaxFrequency != 0 || s.HasField("max_frequency") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("max_frequency")
		s.WriteUint64(x.MaxFrequency)
	}
	if x.SupportsJoin || s.HasField("supports_join") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("supports_join")
		s.WriteBool(x.SupportsJoin)
	}
	if x.ResetsJoinNonces || s.HasField("resets_join_nonces") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("resets_join_nonces")
		s.WriteBool(x.ResetsJoinNonces)
	}
	if true {  
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("default_formatters")
		x.DefaultFormatters.MarshalProtoJSON(s.WithField("default_formatters"))
	}
	s.WriteObjectEnd()
}
func (x *EndDeviceVersion) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.ReadAny()  
		case "ids":
			s.AddField("ids")
			var v EndDeviceVersionIdentifiers
			gogo.UnmarshalMessage(s, &v)
			x.EndDeviceVersionIdentifiers = v
		case "lorawan_version", "lorawanVersion":
			s.AddField("lorawan_version")
			x.LorawanVersion.UnmarshalProtoJSON(s)
		case "lorawan_phy_version", "lorawanPhyVersion":
			s.AddField("lorawan_phy_version")
			x.LorawanPhyVersion.UnmarshalProtoJSON(s)
		case "frequency_plan_id", "frequencyPlanId":
			s.AddField("frequency_plan_id")
			x.FrequencyPlanId = s.ReadString()
		case "photos":
			s.AddField("photos")
			x.Photos = s.ReadStringArray()
		case "supports_class_b", "supportsClassB":
			s.AddField("supports_class_b")
			x.SupportsClassB = s.ReadBool()
		case "supports_class_c", "supportsClassC":
			s.AddField("supports_class_c")
			x.SupportsClassC = s.ReadBool()
		case "default_mac_settings", "defaultMacSettings":
			if !s.ReadNil() {
				x.DefaultMacSettings = &MACSettings{}
				x.DefaultMacSettings.UnmarshalProtoJSON(s.WithField("default_mac_settings", true))
			}
		case "min_frequency", "minFrequency":
			s.AddField("min_frequency")
			x.MinFrequency = s.ReadUint64()
		case "max_frequency", "maxFrequency":
			s.AddField("max_frequency")
			x.MaxFrequency = s.ReadUint64()
		case "supports_join", "supportsJoin":
			s.AddField("supports_join")
			x.SupportsJoin = s.ReadBool()
		case "resets_join_nonces", "resetsJoinNonces":
			s.AddField("resets_join_nonces")
			x.ResetsJoinNonces = s.ReadBool()
		case "default_formatters", "defaultFormatters":
			if !s.ReadNil() {
				x.DefaultFormatters.UnmarshalProtoJSON(s.WithField("default_formatters", true))
			}
		}
	})
}