<PackageReference Include="System.Text.Json" Version="9.0.4" />

JsonException

public class JsonException : Exception
Defines a custom exception object that is thrown when invalid JSON text is encountered, the defined maximum depth is passed, or the JSON text is not compatible with the type of a property on an object.
public long? BytePositionInLine { get; }

Gets the zero-based number of bytes read within the current line before the exception.

public long? LineNumber { get; }

Gets the zero-based number of lines read before the exception.

public string Path { get; }

Gets The path within the JSON where the exception was encountered.

public JsonException(string message, string path, long? lineNumber, long? bytePositionInLine, Exception innerException)

Creates a new exception object to relay error information to the user that includes a specified inner exception.

public JsonException(string message, string path, long? lineNumber, long? bytePositionInLine)

Creates a new exception object to relay error information to the user.

public JsonException(string message, Exception innerException)

Initializes a new instance of the JsonException class, with a specified error message and a reference to the inner exception that is the cause of this exception.

public JsonException(string message)

Initializes a new instance of the JsonException class with a specified error message.

public JsonException()

Initializes a new instance of the JsonException class.

Creates a new exception object with serialized data.