<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />

JsonSerializationException

The exception thrown when an error occurs during JSON serialization or deserialization.
using System; using System.Runtime.CompilerServices; using System.Runtime.Serialization; namespace Newtonsoft.Json { [Serializable] [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public class JsonSerializationException : JsonException { public int LineNumber { get; } public int LinePosition { get; } [System.Runtime.CompilerServices.Nullable(2)] [field: System.Runtime.CompilerServices.Nullable(2)] public string Path { [System.Runtime.CompilerServices.NullableContext(2)] get; } public JsonSerializationException() { } public JsonSerializationException(string message) : base(message) { } public JsonSerializationException(string message, Exception innerException) : base(message, innerException) { } public JsonSerializationException(SerializationInfo info, StreamingContext context) : base(info, context) { } public JsonSerializationException(string message, string path, int lineNumber, int linePosition, [System.Runtime.CompilerServices.Nullable(2)] Exception innerException) : base(message, innerException) { Path = path; LineNumber = lineNumber; LinePosition = linePosition; } internal static JsonSerializationException Create(JsonReader reader, string message) { return Create(reader, message, null); } internal static JsonSerializationException Create(JsonReader reader, string message, [System.Runtime.CompilerServices.Nullable(2)] Exception ex) { return Create(reader as IJsonLineInfo, reader.Path, message, ex); } internal static JsonSerializationException Create([System.Runtime.CompilerServices.Nullable(2)] IJsonLineInfo lineInfo, string path, string message, [System.Runtime.CompilerServices.Nullable(2)] Exception ex) { message = JsonPosition.FormatMessage(lineInfo, path, message); int lineNumber; int linePosition; if (lineInfo != null && lineInfo.HasLineInfo()) { lineNumber = lineInfo.LineNumber; linePosition = lineInfo.LinePosition; } else { lineNumber = 0; linePosition = 0; } return new JsonSerializationException(message, path, lineNumber, linePosition, ex); } } }