func (x *FindRelatedEventsResponse) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.ReadAny()  
		case "events":
			s.AddField("events")
			s.ReadArray(func() {
				if s.ReadNil() {
					x.Events = append(x.Events, nil)
					return
				}
				v := &Event{}
				v.UnmarshalProtoJSON(s.WithField("events", false))
				if s.Err() != nil {
					return
				}
				x.Events = append(x.Events, v)
			})
		}
	})
}
UnmarshalProtoJSON unmarshals the FindRelatedEventsResponse message from JSON.
package ttnpb
import (
	gogo "github.com/TheThingsIndustries/protoc-gen-go-json/gogo"
	jsonplugin "github.com/TheThingsIndustries/protoc-gen-go-json/jsonplugin"
)
func (x *Event) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.Name != "" || s.HasField("name") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("name")
		s.WriteString(x.Name)
	}
	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 len(x.Identifiers) > 0 || s.HasField("identifiers") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("identifiers")
		s.WriteArrayStart()
		var wroteElement bool
		for _, element := range x.Identifiers {
			s.WriteMoreIf(&wroteElement)
			gogo.MarshalMessage(s, element)
		}
		s.WriteArrayEnd()
	}
	if x.Data != nil || s.HasField("data") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("data")
		if x.Data == nil {
			s.WriteNil()
		} else {
			gogo.MarshalAny(s, x.Data)
		}
	}
	if len(x.CorrelationIds) > 0 || s.HasField("correlation_ids") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("correlation_ids")
		s.WriteStringArray(x.CorrelationIds)
	}
	if x.Origin != "" || s.HasField("origin") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("origin")
		s.WriteString(x.Origin)
	}
	if x.Context != nil || s.HasField("context") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("context")
		s.WriteObjectStart()
		var wroteElement bool
		for k, v := range x.Context {
			s.WriteMoreIf(&wroteElement)
			s.WriteObjectStringField(k)
			s.WriteBytes(v)
		}
		s.WriteObjectEnd()
	}
	if x.Visibility != nil || s.HasField("visibility") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("visibility")
		x.Visibility.MarshalProtoJSON(s.WithField("visibility"))
	}
	if x.Authentication != nil || s.HasField("authentication") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("authentication")
		gogo.MarshalMessage(s, x.Authentication)
	}
	if x.RemoteIp != "" || s.HasField("remote_ip") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("remote_ip")
		s.WriteString(x.RemoteIp)
	}
	if x.UserAgent != "" || s.HasField("user_agent") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("user_agent")
		s.WriteString(x.UserAgent)
	}
	if x.UniqueId != "" || s.HasField("unique_id") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("unique_id")
		s.WriteString(x.UniqueId)
	}
	s.WriteObjectEnd()
}
func (x *Event) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.ReadAny()  
		case "name":
			s.AddField("name")
			x.Name = s.ReadString()
		case "time":
			s.AddField("time")
			v := s.ReadTime()
			if s.Err() != nil {
				return
			}
			x.Time = v
		case "identifiers":
			s.AddField("identifiers")
			s.ReadArray(func() {
				var v EntityIdentifiers
				gogo.UnmarshalMessage(s, &v)
				x.Identifiers = append(x.Identifiers, &v)
			})
		case "data":
			s.AddField("data")
			v := gogo.UnmarshalAny(s)
			if s.Err() != nil {
				return
			}
			x.Data = v
		case "correlation_ids", "correlationIds":
			s.AddField("correlation_ids")
			x.CorrelationIds = s.ReadStringArray()
		case "origin":
			s.AddField("origin")
			x.Origin = s.ReadString()
		case "context":
			s.AddField("context")
			x.Context = make(map[string][]byte)
			s.ReadStringMap(func(key string) {
				x.Context[key] = s.ReadBytes()
			})
		case "visibility":
			if !s.ReadNil() {
				x.Visibility = &Rights{}
				x.Visibility.UnmarshalProtoJSON(s.WithField("visibility", true))
			}
		case "authentication":
			s.AddField("authentication")
			var v Event_Authentication
			gogo.UnmarshalMessage(s, &v)
			x.Authentication = &v
		case "remote_ip", "remoteIp":
			s.AddField("remote_ip")
			x.RemoteIp = s.ReadString()
		case "user_agent", "userAgent":
			s.AddField("user_agent")
			x.UserAgent = s.ReadString()
		case "unique_id", "uniqueId":
			s.AddField("unique_id")
			x.UniqueId = s.ReadString()
		}
	})
}
func (x *FindRelatedEventsResponse) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if len(x.Events) > 0 || s.HasField("events") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("events")
		s.WriteArrayStart()
		var wroteElement bool
		for _, element := range x.Events {
			s.WriteMoreIf(&wroteElement)
			element.MarshalProtoJSON(s.WithField("events"))
		}
		s.WriteArrayEnd()
	}
	s.WriteObjectEnd()
}