When deserializing an object from JSON string, an error is output:

Could Not Cast or Convert From System.String to Position2D

That is, it is impossible to convert a string view to the Position2D class.

Is it possible to add something in this class so that it can be created from the line? He served successfully, but it does not want back.

Public Struct Position2D
    Public int x;
    Public int Y;
    Override Public String Tostring ()
        Return X.Tostring () + "x" + y.tostring ();

But JSON himself and the code, with the help of which you desperialize it, you certainly do not show? Tip Right: Try creating a row constructor.

aepot2021-07-21 18:14:52

At a minimum, specify the library -Newtonsoft JSON, System.Text.json, another.

Uranus2021-07-21 19:06:43

Newtonsoft json. As I understood here you need an Explicit Operator for such copying.

manking2021-07-21 20:41:33