How to parse same fields from one object to another to invoke a PATCH in API REST

Hello, I have a form with ${getOperation} Data but I need to send another information to PATCH.
Form data is OperationDto()(all fields are strings) but body is OperationSendDto() (all fields are strings). How can I populate OperationSendDto from OperationDto

I defined 2 properties:

  • getOperation -> new new OperationDto()
  • getOperationSend -> new OperationSendDto()

There are only to fields to complete and send to patch

OperationSendDto.field1 = getOperation.field12
OperationSendDto.field2 = getOperation.field15

Body is OperationSendDto type

Thanks in advance.

Regards.

You will have to instantiate the target object from the source:

new OperationSendDto
{
    field1 = getOperation.field12,
    field2 = getOperation.field15
}