-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
dotnet/corefx
#37275Closed
Copy link
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Text.JsonenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions
Milestone
Description
Runtime version: 3.0.0-preview4-27513-05
Consider:
public class Person
{
public string Name { get; set; }
public Address Address { get; set; }
}
public class Address
{
public int ZipCode { get; set; }
}
var content = "{ \"Name\": \"Test\", \"Address\": { \"ZipCode\": \"not-an-int\" } }";
var result = JsonSerializer.Parse(content, typeof(TestModel));This throws an JsonReaderException, as expected:
Unhandled Exception: System.Text.Json.JsonReaderException: The JSON value from [test2.Person].Address.ZipCode could not be converted to System.Int32.The exception includes the path as part of the error message, but there isn't a way to retrieve it as a property from the exception instance. It would be useful to additionally exposed the ath as a property along with the line and column information that JsonReaderException includes.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Text.JsonenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions