Closed Zig1375 closed 1 year ago
Nice feature. I'll add it soon.
Sorry for long response. Lost this issue. I add method fromString and toString. Now you can deserilize direct from string. toString ovverride default toString object method an make serializtion to json string.
const user = User.fromString('{"firstName": "John Doe"}');
fetch("url", {
method: "POST",
body: user.toString()
});
Actually JSON is not an object, but a string and it would be great if the
fromJSON
method can receive a string was well.because at this moment the code looks like this: