Wow its been way too long

Working on some neat projects and actually learning C# along with MAUI/Uno/Avalonia UI frameworks.

One of the things I’ve come to really like is the simplicity of serializing and deserializing class instances to /from JSON.

In C# this is a one liner. In Xojo its a pile of work to read the JSON, create an instance & then copy the Json data into the new instance

In C# literally

var item = JsonSerializer.Deserialize<Type>( data ) ;

will take the Json and move the corresponding json keys into the matching properties in a new instance of the type given.
Yeah the notation is a little odd to Xojo users (but Xojo has NO notation for doing this sort of thing)

At the closest it might be

Vendor_Item item = JsonSerializer.Deserialize(content, new Vendor_Item);

That is assuming Xojo had a JsonSerializer that worked like this. While YOU have to make sure you call it right (new whatever) its at least close

But, it doesnt have one like that

However, I have created one (you HAD to know that was coming right ?)

Give it a spin & leave me feedback about it if you would

Leave a Reply

Your email address will not be published. Required fields are marked *