I'm doing a REST service. A method has as body parameter a JSON corresponding to a class A.
In my production I have class A so that I retrieve the parameters using a dynamic object, such that:
Set body = ##class(%DynamicObject).%FromJSON(%request.Content) Set myObjectA = ##class(A).%New() Set myObjectA.Id = body.Id Set myObjectA.Name = body.Name Set myObjectA.Date = body.Date Set myObjectA.Salary = body.Salary
I would like to know if I can avoid doing the manual mapping, doing a casting, since I am sure that FromJSON will return a class A. Something like this: