You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 5, 2022. It is now read-only.
JSON.stringify uses value returned by toJSON and serializes it to string, so it should be an object.
Currenty Model objects are double-serialized when using JSON.stringify on them.
Please refer to:
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized.
JSON.stringify uses value returned by toJSON and serializes it to string, so it should be an object.
Currenty Model objects are double-serialized when using JSON.stringify on them.
Please refer to:
https://github.com/douglascrockford/JSON-js/blob/master/json.js#L75-81