Example #1
0
        protected virtual void Serialize(ITelemetry item, IJsonWriter writer)
        {
            writer.WriteStartObject();

            WriteTelemetryName(item, writer);
            WriteEnvelopeProperties(item, writer, _contextTagKeys);
            writer.WritePropertyName("data");
            {
                writer.WriteStartObject();

                var dataModelItem = item as IDataModelTelemetry;
                if (dataModelItem != null)
                {
                    writer.WriteProperty("baseType", dataModelItem.BaseType);
                    writer.WritePropertyName("baseData");
                    {
                        writer.WriteStartObject();

                        dataModelItem.SerializeData(this, writer);

                        writer.WriteEndObject();
                    }
                }
                writer.WriteEndObject();
            }

            writer.WriteEndObject();
        }
        private static void SerializeExceptions(IEnumerable <ExceptionDetails> exceptions, IJsonWriter writer)
        {
            int exceptionArrayIndex = 0;

            foreach (ExceptionDetails exceptionDetails in exceptions)
            {
                if (exceptionArrayIndex++ != 0)
                {
                    writer.WriteComma();
                }

                writer.WriteStartObject();
                writer.WriteProperty("id", exceptionDetails.id);
                if (exceptionDetails.outerId != 0)
                {
                    writer.WriteProperty("outerId", exceptionDetails.outerId);
                }

                writer.WriteProperty(
                    "typeName",
                    Utils.PopulateRequiredStringValue(exceptionDetails.typeName, "typeName", typeof(ExceptionTelemetry).FullName));
                writer.WriteProperty(
                    "message",
                    Utils.PopulateRequiredStringValue(exceptionDetails.message, "message", typeof(ExceptionTelemetry).FullName));

                if (exceptionDetails.hasFullStack)
                {
                    writer.WriteProperty("hasFullStack", exceptionDetails.hasFullStack);
                }

                writer.WriteProperty("stack", exceptionDetails.stack);

                if (exceptionDetails.parsedStack.Count > 0)
                {
                    writer.WritePropertyName("parsedStack");

                    writer.WriteStartArray();

                    int stackFrameArrayIndex = 0;

                    foreach (StackFrame frame in exceptionDetails.parsedStack)
                    {
                        if (stackFrameArrayIndex++ != 0)
                        {
                            writer.WriteComma();
                        }

                        writer.WriteStartObject();
                        SerializeStackFrame(frame, writer);
                        writer.WriteEndObject();
                    }

                    writer.WriteEndArray();
                }

                writer.WriteEndObject();
            }
        }
 public void ToJson(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("Name");
     writer.Write(this.Name);
     writer.WriteEndObject();
 }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("id", this.Id);
     writer.WriteProperty("firstSession", this.IsFirst);
     writer.WriteEndObject();
 }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("id", this.Id);
     writer.WriteProperty("firstSession", this.IsFirst);
     writer.WriteEndObject();
 }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("sdkVersion", this.SdkVersion);
     writer.WriteProperty("agentVersion", this.AgentVersion);
     writer.WriteEndObject();
 }
Example #7
0
 public void ToJson(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("teamId");
     writer.Write(this.TeamId);
     writer.WriteEndObject();
 }
Example #8
0
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("sdkVersion", this.SdkVersion);
     writer.WriteProperty("agentVersion", this.AgentVersion);
     writer.WriteEndObject();
 }
        public void ToJson(IJsonWriter writer)
        {
            writer.WriteStartObject();

            if (this.ErrorCode.HasValue)
            {
                writer.WritePropertyName("errorCode");
                writer.Write(this.ErrorCode);
            }

            if (this.ErrorMessage.IsPresent())
            {
                writer.WritePropertyName("errorMessage");
                writer.Write(this.ErrorMessage);
            }

            writer.WritePropertyName("items");
            writer.WriteStartArray();

            foreach (var item in this.Items)
            {
                JSON.GetSerializer().Serialize(writer, item);
            }

            writer.WriteEndArray();

            writer.WriteEndObject();
        }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("id", this.Id);
     writer.WriteProperty("name", this.Name);
     writer.WriteProperty("syntheticSource", this.SyntheticSource);
     writer.WriteEndObject();
 }
Example #11
0
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("id", Id);
     writer.WriteProperty("name", Name);
     writer.WriteProperty("syntheticSource", SyntheticSource);
     writer.WriteEndObject();
 }
Example #12
0
 public void ToJson(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("id");
     writer.Write(this.Id);
     writer.WritePropertyName("version");
     writer.Write(this.Version);
     writer.WriteEndObject();
 }
Example #13
0
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("id", Id);
     writer.WriteProperty("userAgent", UserAgent);
     writer.WriteProperty("accountId", AccountId);
     writer.WriteProperty("anonUserAcquisitionDate", AcquisitionDate);
     writer.WriteEndObject();
 }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("id", this.Id);
     writer.WriteProperty("userAgent", this.UserAgent);
     writer.WriteProperty("accountId", this.AccountId);
     writer.WriteProperty("anonUserAcquisitionDate", this.AcquisitionDate);
     writer.WriteProperty("storeRegion", this.StoreRegion);
     writer.WriteEndObject();
 }      
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("id", this.Id);
     writer.WriteProperty("userAgent", this.UserAgent);
     writer.WriteProperty("accountId", this.AccountId);
     writer.WriteProperty("anonUserAcquisitionDate", this.AcquisitionDate);
     writer.WriteProperty("storeRegion", this.StoreRegion);
     writer.WriteEndObject();
 }
        public void ToJson(IJsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("eventId");
            writer.Write(this.EventId);
            writer.WritePropertyName("eventTimestamp");
            writer.Write(this.EventTimestamp);

            ToJsonData(writer);

            writer.WriteEndObject();
        }
Example #17
0
        /// <summary>
        /// The encode.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="writer">The writer.</param>
        public void Encode(T value, IJsonWriter writer)
        {
            if (value == null)
            {
                writer.WriteNull();
                return;
            }

            writer.WriteStartObject();
            this.EncodeFields(value, writer);
            writer.WriteEndObject();
        }
Example #18
0
        /// <summary>
        /// Writes the contents of this Json type using the specified
        /// <see cref="NetServ.Net.Json.IJsonWriter"/>.
        /// </summary>
        /// <param name="writer">The Json writer.</param>
        public void Write(IJsonWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.WriteBeginObject();
            foreach (KeyValuePair <string, IJsonType> pair in this)
            {
                writer.WriteName(pair.Key);
                pair.Value.Write(writer);
            }
            writer.WriteEndObject();
        }
Example #19
0
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("type", Type);
     writer.WriteProperty("id", Utils.PopulateRequiredStringValue(Id, "id", typeof(DeviceContext).FullName));
     writer.WriteProperty("osVersion", OperatingSystem);
     writer.WriteProperty("oemName", OemName);
     writer.WriteProperty("model", Model);
     writer.WriteProperty("network", NetworkType);
     writer.WriteProperty("resolution", ScreenResolution);
     writer.WriteProperty("locale", Language);
     writer.WriteProperty("roleName", RoleName);
     writer.WriteProperty("roleInstance", RoleInstance);
     writer.WriteEndObject();
 }
Example #20
0
        public void ToJson(IJsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("teamId");
            writer.Write(this.TeamId);
            writer.WritePropertyName("items");

            writer.WriteStartArray();
            foreach (var item in _items)
            {
                item.ToJson(writer);
            }
            writer.WriteEndArray();

            writer.WriteEndObject();
        }
        void IJsonSerializable.Serialize(IJsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WriteProperty("type", this.Type);
            writer.WriteProperty("id", Utils.PopulateRequiredStringValue(this.Id, "id", typeof(DeviceContext).FullName));
            writer.WriteProperty("osVersion", this.OperatingSystem);
            writer.WriteProperty("oemName", this.OemName);
            writer.WriteProperty("model", this.Model);
            writer.WriteProperty("network", this.NetworkType);
            writer.WriteProperty("resolution", this.ScreenResolution);
            writer.WriteProperty("locale", this.Language);
#pragma warning disable 618
            writer.WriteProperty("roleName", this.RoleName);
            writer.WriteProperty("roleInstance", this.RoleInstance);
#pragma warning restore 618
            writer.WriteEndObject();
        }
Example #22
0
            public void ToJson(IJsonWriter writer)
            {
                writer.WriteStartObject();
                writer.WritePropertyName("name");
                writer.Write(this.Name);
                writer.WritePropertyName("number");
                writer.Write(this.Number);

                writer.WritePropertyName("children");
                writer.WriteStartArray();
                foreach (var item in Children)
                {
                    item.ToJson(writer);
                }
                writer.WriteEndArray();

                writer.WriteEndObject();
            }
Example #23
0
        public void ToJson(IJsonWriter writer)
        {
            writer.WriteStartObject();

            if (this.ErrorCode.HasValue)
            {
                writer.WritePropertyName("errorCode");
                writer.Write(this.ErrorCode);
            }

            if (this.ErrorMessage.IsPresent())
            {
                writer.WritePropertyName("errorMessage");
                writer.Write(this.ErrorMessage);
            }

            writer.WriteEndObject();
        }
Example #24
0
        /// <inheritdoc/>
        public override void Write(IJsonWriter writer)
        {
            writer.WriteStartObject(this.properties.Count);

            foreach (var property in this.properties)
            {
                writer.WritePropertyKey(property.Key);

                if (property.Value != null)
                {
                    property.Value.Write(writer);
                }
                else
                {
                    writer.WriteNull();
                }
            }

            writer.WriteEndObject();
        }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("version", this.Version);
     writer.WriteEndObject();
 }
Example #26
0
 /// <summary>
 /// The encode.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <param name="writer">The writer.</param>
 public void Encode(T value, IJsonWriter writer)
 {
     writer.WriteStartObject();
     this.EncodeFields(value, writer);
     writer.WriteEndObject();
 }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("ip", this.Ip);
     writer.WriteEndObject();
 }
        public void WriteAsJson(IJsonWriter jw)
        {
            jw.WriteStartObject();

            jw.WritePropertyName(nameof(Language)); jw.WriteStringValue(Languages.EnumToCode(Language));
            jw.WritePropertyName(nameof(Length)); jw.WriteNumberValue(Length);
            jw.WritePropertyName(nameof(Value)); jw.WriteStringValue(Value);

            if (UID.IsNotNull())
            {
                jw.WritePropertyName(nameof(UID)); jw.WriteStringValue(UID);
            }

            if (Metadata is object && Metadata.Any())
            {
                jw.WritePropertyName(nameof(Metadata));
                jw.WriteStartObject();
                foreach (var kv in Metadata)
                {
                    jw.WritePropertyName(kv.Key); jw.WriteStringValue(kv.Value);
                }
                jw.WriteEndObject();
            }

            if (Labels is object && Labels.Length > 0)
            {
                jw.WritePropertyName(nameof(Labels));
                jw.WriteStartArray();
                foreach (var l in Labels)
                {
                    jw.WriteStringValue(l);
                }
                jw.WriteEndArray();
            }

            jw.WritePropertyName(nameof(TokensData));
            jw.WriteStartArray();
            for (int i = 0; i < TokensData.Length; i++)
            {
                var spanData = TokensData[i];
                jw.WriteStartArray();
                for (int j = 0; j < spanData.Length; j++)
                {
                    var  tk = spanData[j];
                    long ix = GetTokenIndex(i, j);

                    jw.WriteStartObject();
                    jw.WritePropertyName(nameof(TokenData.Bounds));
                    jw.WriteStartArray();
                    jw.WriteNumberValue(tk.LowerBound);
                    jw.WriteNumberValue(tk.UpperBound);
                    jw.WriteEndArray();

                    if (tk.Tag != PartOfSpeech.NONE)
                    {
                        jw.WritePropertyName(nameof(TokenData.Tag)); jw.WriteStringValue(tk.Tag.ToString());
                    }

                    if (tk.Head >= 0)
                    {
                        jw.WritePropertyName(nameof(TokenData.Head)); jw.WriteNumberValue(tk.Head);
                    }

                    if (tk.Frequency != 0)
                    {
                        jw.WritePropertyName(nameof(TokenData.Frequency)); jw.WriteNumberValue(tk.Frequency);
                    }

                    if (!string.IsNullOrEmpty(tk.Replacement))
                    {
                        jw.WritePropertyName(nameof(TokenData.Replacement)); jw.WriteStringValue(tk.Replacement);
                    }

                    if (TokenMetadata is object)
                    {
                        if (TokenMetadata.TryGetValue(ix, out var tokenMetadata))
                        {
                            if (!(tokenMetadata is null) && tokenMetadata.Any())
                            {
                                jw.WritePropertyName(nameof(Metadata));
                                jw.WriteStartObject();
                                foreach (var kv in tokenMetadata)
                                {
                                    jw.WritePropertyName(kv.Key); jw.WriteStringValue(kv.Value);
                                }
                                jw.WriteEndObject();
                            }
                        }
                    }

                    if (EntityData is object)
                    {
                        if (EntityData.TryGetValue(ix, out var entities))
                        {
                            if (!(entities is null) && entities.Any())
                            {
                                jw.WritePropertyName(nameof(EntityType));
                                jw.WriteStartArray();
                                for (int k = 0; k < entities.Length; k++)
                                {
                                    jw.WriteStartObject();
                                    jw.WritePropertyName(nameof(EntityType.Type)); jw.WriteStringValue(entities[k].Type);
                                    jw.WritePropertyName(nameof(EntityType.Tag)); jw.WriteStringValue(entities[k].Tag.ToString());

                                    if (entities[k].TargetUID.IsNotNull())
                                    {
                                        jw.WritePropertyName(nameof(EntityType.TargetUID)); jw.WriteStringValue(entities[k].TargetUID);
                                    }

                                    if (!(entities[k].Metadata is null) && entities[k].Metadata.Any())
                                    {
                                        jw.WritePropertyName(nameof(EntityType.Metadata));
                                        jw.WriteStartObject();
                                        foreach (var kv in entities[k].Metadata)
                                        {
                                            jw.WritePropertyName(kv.Key); jw.WriteStringValue(kv.Value);
                                        }
                                        jw.WriteEndObject();
                                    }

                                    jw.WriteEndObject();
                                }
                                jw.WriteEndArray();
                            }
                        }
                    }
                    jw.WriteEndObject();
                }
                jw.WriteEndArray();
            }
            jw.WriteEndArray();

            jw.WriteEndObject();
        }
Example #29
0
        private void ParseArrayOrObject(ref PacketReader reader, ValueType valueType, bool small, bool isObject)
        {
            int startIndex     = reader.Consumed;
            int valueSize      = small ? 2 : 4;
            int elementsNumber = ReadJsonSize(ref reader, small);
            int bytesNumber    = ReadJsonSize(ref reader, small);

            // Key entries
            int[] keyOffset = isObject ? new int[elementsNumber] : null;
            int[] keyLength = isObject ? new int[elementsNumber] : null;
            if (isObject)
            {
                for (int i = 0; i < elementsNumber; i++)
                {
                    keyOffset[i] = ReadJsonSize(ref reader, small);
                    keyLength[i] = reader.ReadUInt16LittleEndian();
                }
            }

            // Value entries
            var entries = new ValueEntry[elementsNumber];

            for (int i = 0; i < elementsNumber; i++)
            {
                ValueType type = ReadValueType(ref reader);
                if (type == ValueType.LITERAL)
                {
                    entries[i] = ValueEntry.FromInlined(type, ReadLiteral(ref reader));
                    reader.Advance(valueSize - 1);
                }
                else if (type == ValueType.INT16)
                {
                    entries[i] = ValueEntry.FromInlined(type, (Int16)reader.ReadUInt16LittleEndian());
                    reader.Advance(valueSize - 2);
                }
                else if (type == ValueType.UINT16)
                {
                    entries[i] = ValueEntry.FromInlined(type, (UInt16)reader.ReadUInt16LittleEndian());
                    reader.Advance(valueSize - 2);
                }
                else if (type == ValueType.INT32 && !small)
                {
                    entries[i] = ValueEntry.FromInlined(type, (Int32)reader.ReadUInt32LittleEndian());
                }
                else if (type == ValueType.UINT32 && !small)
                {
                    entries[i] = ValueEntry.FromInlined(type, (UInt32)reader.ReadUInt32LittleEndian());
                }
                else
                {
                    int offset = ReadJsonSize(ref reader, small);
                    if (offset >= bytesNumber)
                    {
                        throw new FormatException("The offset in JSON value was too long");
                    }
                    entries[i] = ValueEntry.FromOffset(type, offset);
                }
            }

            // Key rows
            string[] keys = null;
            if (isObject)
            {
                keys = new string[elementsNumber];
                for (int i = 0; i < elementsNumber; i++)
                {
                    // 1 - Remove a hole between keys
                    Advance(ref reader, startIndex, keyOffset[i]);
                    keys[i] = reader.ReadString(keyLength[i]) ?? string.Empty /* JSON can have empty keys */;
                }
            }

            // Value rows
            if (isObject)
            {
                _writer.WriteStartObject();
            }
            else
            {
                _writer.WriteStartArray();
            }
            for (int i = 0; i < elementsNumber; i++)
            {
                if (isObject)
                {
                    _writer.WriteKey(keys[i]);
                }

                ValueEntry entry = entries[i];
                if (!entry.Inlined)
                {
                    // 2 - Remove a hole between values
                    Advance(ref reader, startIndex, entry.Offset);
                    ParseNode(ref reader, entry.Type);
                }

                else if (entry.Value == null)
                {
                    _writer.WriteNull();
                }
                else if (entry.Type == ValueType.LITERAL)
                {
                    _writer.WriteValue((bool)entry.Value);
                }

                else if (entry.Type == ValueType.INT16)
                {
                    _writer.WriteValue((Int16)entry.Value);
                }
                else if (entry.Type == ValueType.UINT16)
                {
                    _writer.WriteValue((UInt16)entry.Value);
                }
                else if (entry.Type == ValueType.INT32)
                {
                    _writer.WriteValue((Int32)entry.Value);
                }
                else if (entry.Type == ValueType.UINT32)
                {
                    _writer.WriteValue((UInt32)entry.Value);
                }
            }
            if (isObject)
            {
                _writer.WriteEndObject();
            }
            else
            {
                _writer.WriteEndArray();
            }

            // 3 - Remove a hole from the end
            Advance(ref reader, startIndex, bytesNumber);
        }
        /// <summary>
        /// Serialize the <see cref="ITelemetry"/> item into a JSON object. All context and data items are fields
        /// in the object. If the item has custom properties or measurements then those are serialized as a list
        /// name/value pairs. Exception details, if present are serialized as an array of exception information which
        /// is a complex object.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="writer"></param>
        protected virtual void Serialize(ITelemetry item, IJsonWriter writer)
        {
            writer.WriteStartObject();

            writer.WriteProperty("telemetrytype", item.TelemetryName);
            writer.WriteProperty("time", item.Timestamp.UtcDateTime.ToString("o", CultureInfo.InvariantCulture));

            var samplingSupportingTelemetry = item as ISupportSampling;

            if (samplingSupportingTelemetry != null &&
                samplingSupportingTelemetry.SamplingPercentage.HasValue &&
                (samplingSupportingTelemetry.SamplingPercentage.Value > 0.0 + 1.0E-12) &&
                (samplingSupportingTelemetry.SamplingPercentage.Value < 100.0 - 1.0E-12))
            {
                writer.WriteProperty("sampleRate", samplingSupportingTelemetry.SamplingPercentage.Value);
            }

            writer.WriteProperty("seq", item.Sequence);

            //serialize out the telemetry context into the current object
            if (item.Context != null)
            {
                var contextTags = item.Context.ToContextTags(_contextTagKeys);
                foreach (var tag in contextTags)
                {
                    writer.WriteProperty(tag.Key, tag.Value);
                }
            }

            //serialize the main data tags for the telemetry.
            var dataTags = item.GetTaggedData();

            foreach (var tag in dataTags)
            {
                writer.WriteProperty(tag.Key, tag.Value);
            }

            //if the telemetry has additional properties then serialize the properties into a
            //list of name/value pairs.
            var withProperties = item as ISupportProperties;

            if (withProperties != null && withProperties.Properties.Count > 0)
            {
                writer.WriteProperty("properties", withProperties.Properties);
            }

            //if the telemetry has measurements then serialize the measurements into a
            //list of name/value pairs.
            var withMeasurements = item as ISupportMetrics;

            if (withMeasurements != null && withMeasurements.Metrics.Count > 0)
            {
                writer.WriteProperty("measurements", withMeasurements.Metrics);
            }

            //if the telemtry has a list of exception details then serialize the list
            //into a JSON array.
            var withExceptions = item as IExceptionTelemetry;

            if (withExceptions != null && withExceptions.ExceptionDetails.Count > 0)
            {
                writer.WritePropertyName("exceptions");
                {
                    writer.WriteStartArray();

                    SerializeExceptions(withExceptions.ExceptionDetails, writer);

                    writer.WriteEndArray();
                }
            }

            writer.WriteEndObject();
        }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("type", this.Type);
     writer.WriteProperty("id", Utils.PopulateRequiredStringValue(this.Id, "id", typeof(DeviceContext).FullName));
     writer.WriteProperty("osVersion", this.DeviceOSVersion);
     writer.WriteProperty("oemName", this.OemName);
     writer.WriteProperty("model", this.Model);
     writer.WriteProperty("network", this.NetworkType);
     writer.WriteProperty("resolution", this.ScreenResolution);
     writer.WriteProperty("locale", this.Language);
     writer.WriteProperty("roleName", this.RoleName);
     writer.WriteProperty("roleInstance", this.RoleInstance);
     writer.WriteEndObject();
 }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("version", this.Version);
     writer.WriteEndObject();
 }
Example #33
0
 public void ToJson(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteEndObject();
 }
        private static void SerializeExceptions(IEnumerable<ExceptionDetails> exceptions, IJsonWriter writer)
        {
            int exceptionArrayIndex = 0;

            foreach (ExceptionDetails exceptionDetails in exceptions)
            {
                if (exceptionArrayIndex++ != 0)
                {
                    writer.WriteComma();
                }

                writer.WriteStartObject();
                writer.WriteProperty("id", exceptionDetails.id);
                if (exceptionDetails.outerId != 0)
                {
                    writer.WriteProperty("outerId", exceptionDetails.outerId);
                }

                writer.WriteProperty(
                    "typeName",
                    Utils.PopulateRequiredStringValue(exceptionDetails.typeName, "typeName", typeof(ExceptionTelemetry).FullName));
                writer.WriteProperty(
                    "message",
                    Utils.PopulateRequiredStringValue(exceptionDetails.message, "message", typeof(ExceptionTelemetry).FullName));

                if (exceptionDetails.hasFullStack)
                {
                    writer.WriteProperty("hasFullStack", exceptionDetails.hasFullStack);
                }

                writer.WriteProperty("stack", exceptionDetails.stack);

                if (exceptionDetails.parsedStack.Count > 0)
                {
                    writer.WritePropertyName("parsedStack");

                    writer.WriteStartArray();

                    int stackFrameArrayIndex = 0;

                    foreach (StackFrame frame in exceptionDetails.parsedStack)
                    {
                        if (stackFrameArrayIndex++ != 0)
                        {
                            writer.WriteComma();
                        }

                        writer.WriteStartObject();
                        SerializeStackFrame(frame, writer);
                        writer.WriteEndObject();
                    }

                    writer.WriteEndArray();
                }

                writer.WriteEndObject();
            }
        }
 void IJsonSerializable.Serialize(IJsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("ip", this.Ip);
     writer.WriteEndObject();
 }