Is there any way to convert Ember Object into plain javascript object?

Here is my dirty workaround

var newModel = JSON.parse(JSON.stringify(model));

If your object is a subclass of ember-data model notice you can use the toJSON method otherwise you can use:

JSON.parse(JSON.stringify(emberObj))

To grab any values which support native json serialization (i.e. not functions/methods)


I would do something similar to the person above, but I'd do it a little bit differently.

Mixin

App.NativeObject = Ember.Mixin.create({
    toNative: function() {
        var properties = [];
        for (var key in this) {
            if (jQuery.inArray(Ember.typeOf(object[key]), ['string', 'number', 'boolean']) !== -1) {
                properties.push(key);
            }
        }
        return this.getProperties(properties);
    }
});

Object

Then you just need to implement the App.NativeObject mixin in your objects that you would like the toNative on:

var Object = Ember.Object.extend(App.NativeObject, {
    name: 'Adam',
    count: 4
});

We then have the toNative method on all the objects that implement our mixin.

Obligatory jsFiddle: http://jsfiddle.net/jumUx/