Method name 'toJSON' should rename as 'toPlain'
See original GitHub issue /**
* Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all values gotten from the DB, and apply all custom getters.
*
* @see {@link Model#get}
* @return {object}
*/
toJSON() {
return _.clone(
this.get({
plain: true
})
);
}
This method should return a JSON string, that’s make sense, but not a plain Object. Change it’s name to toPlain is better.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How can I change the property name of a serialized entity ...
With class-transformer , you can change the name of a column with @Expose : @Expose({ name: "name_column" }) name: string;. For the ...
Read more >Rename refactoring | ReSharper Documentation
This refactoring allows you to change name of any symbol or project in your solution. All references to and usages of the symbol...
Read more >JSON-LD 1.1
JSON is a useful data serialization and messaging format. This specification defines JSON-LD 1.1, a JSON-based format to serialize Linked ...
Read more >Renaming an object key #979 - bblanchon/ArduinoJson
Currently, it is not possible to rename an object key efficiently. However, renaming an object key can be handy at times.
Read more >Serialization | NestJS - A progressive Node.js framework
Serialization is a process that happens before objects are returned in a ... You can use the @Expose() decorator to provide alias names...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
toJSON name has a special meaning.
You’re right. I misunderstand. Sorry to bother you.