How can I change the property name of a serialized entity with toJSON?
问题 I want to serialize a property with a different name than it has in the entity. @Entity() export class MyEntity { // This should be serialized with name_column in JSON @Column() name: string } When I call classToPlain I want the property name to be serialized to name_column : classToPlain(myEntity) // returns: {name: 'my name'} // should be: {name_column: 'my name'} 回答1: Is there a specific reason you are using json-typescript-mapper instead of class-transformer, which is natively supported