Ember.js: Ember 3.0 - Failed assertion when JSON.stringify -ing an Ember Object

Created on 5 Mar 2018  路  2Comments  路  Source: emberjs/ember.js

Upgrading to Ember 3.0 and using JSON.stringify, results in following failed assertion

Assertion Failed: You attempted to access `someValue.toJSON` (on `<(unknown mixin):ember2486>`), but `someValue` is a computed property.鈫碘喌Due to certain internal implementation details of Ember,

I read the linked RFCs and discussion and I understand this is just a precautionary assertion, but this breaks JSON.stringify usage.

https://github.com/douglascrockford/JSON-js/blob/master/json2.js#L237-L238

screen shot 2018-03-05 at 6 48 09 pm

Most helpful comment

Thank you for reporting!

We need to add toJSON as an exception in this list:

https://github.com/emberjs/ember.js/blob/3240b4a8756a066ff0afe67198b15f78ce66f426/packages/ember-metal/lib/properties.js#L126-L130

All 2 comments

Was this page helpful?
0 / 5 - 0 ratings