Exemple #1
0
        public override void WriteJson(JsonWriter writer, IAttributeValueCollection value, JsonSerializer serializer)
        {
            var agentAttribs = value.GetAttributeValues(AttributeClassification.AgentAttributes).ToArray();
            var userAttribs  = value.GetAttributeValues(AttributeClassification.UserAttributes).ToArray();

            if (agentAttribs.Length == 0 && userAttribs.Length == 0)
            {
                return;
            }

            writer.WriteStartObject();

            if (agentAttribs.Length > 0)
            {
                writer.WritePropertyName("a");
                JsonSerializerHelpers.WriteCollection(writer, agentAttribs);
            }


            if (userAttribs.Length > 0)
            {
                writer.WritePropertyName("u");
                JsonSerializerHelpers.WriteCollection(writer, userAttribs);
            }

            writer.WriteEndObject();
        }
 public override void WriteJson(JsonWriter writer, ISpanEventWireModel value, JsonSerializer serializer)
 {
     writer.WriteStartArray();
     JsonSerializerHelpers.WriteCollection(writer, value.GetAttributeValues(AttributeClassification.Intrinsics));
     JsonSerializerHelpers.WriteCollection(writer, value.GetAttributeValues(AttributeClassification.UserAttributes));
     JsonSerializerHelpers.WriteCollection(writer, value.GetAttributeValues(AttributeClassification.AgentAttributes));
     writer.WriteEndArray();
 }