feat: Adds JSON convertibles (#1253)
This commit is contained in:
parent
ff79d3db40
commit
0abf72ed2f
7 changed files with 108 additions and 1 deletions
|
|
@ -95,9 +95,10 @@ public class Point2DConverter : JsonConverter<Point2D>
|
|||
public override Point2D Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
|
||||
reader.TokenType switch
|
||||
{
|
||||
JsonTokenType.String => Point2D.Parse(reader.GetString(), null),
|
||||
JsonTokenType.StartArray => DeserializeArray(ref reader),
|
||||
JsonTokenType.StartObject => DeserializeObj(ref reader),
|
||||
_ => throw new JsonException("Invalid Json for Point3D")
|
||||
_ => throw new JsonException("Invalid json for Point3D")
|
||||
};
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, Point2D value, JsonSerializerOptions options)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue